Documentation ¶
Overview ¶
Package smtp
Package smtp ¶
Package smtp ¶
Package smtp ¶
Package smtp
Index ¶
- Constants
- func ModuleName() string
- type SmtpClient
- func (s *SmtpClient) Send(subject, message string, attach []string) error
- func (s *SmtpClient) SendContext(context context.Context, subject, message string, attach []string) error
- func (s *SmtpClient) SendHtml(subject, data string, isFile bool, attach []string) error
- func (s *SmtpClient) SendHtmlContext(context context.Context, subject, data string, isFile bool, attach []string) error
- func (s *SmtpClient) Try() error
Constants ¶
View Source
const ( Text = "text/plain" Html = "text/html" )
View Source
const ( ErrCheck = "check smtp config failed" ErrNoTo = "no receiver found" ErrNoHtml = "no html file specified" ErrContextNil = "context is nil" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type SmtpClient ¶
type SmtpClient struct { Sender string // 发件邮箱 NickSender string // 发件邮箱的别名 为空时与Sender一致 PassWord string // 发件密码 SmtpHost string // smtp提供商 SmtpPort int // smtp端口 To []string // 主送 Cc []string // 抄送 Bcc []string // 暗送 }
func (*SmtpClient) Send ¶
func (s *SmtpClient) Send(subject, message string, attach []string) error
Send 纯文本 subject 主题 message 正文 attach 附件
func (*SmtpClient) SendContext ¶
func (s *SmtpClient) SendContext(context context.Context, subject, message string, attach []string) error
SendContext 带上下文的发送
func (*SmtpClient) SendHtml ¶
func (s *SmtpClient) SendHtml(subject, data string, isFile bool, attach []string) error
SendHtml html data 文件或者html文本 isFile 为true时data以html文件的方式解析
func (*SmtpClient) SendHtmlContext ¶
func (s *SmtpClient) SendHtmlContext(context context.Context, subject, data string, isFile bool, attach []string) error
SendHtmlContext 带上下文的发送
Click to show internal directories.
Click to hide internal directories.