Documentation ¶ Overview ¶ Package mail 发送短信 Index ¶ type Driver type Email type From type Mailer func NewMailer() *Mailer func (mailer *Mailer) Send(email Email) bool type SMTP func (s *SMTP) Send(email Email, config map[string]string) bool Constants ¶ This section is empty. Variables ¶ This section is empty. Functions ¶ This section is empty. Types ¶ type Driver ¶ type Driver interface { // 检查验证码 Send(email Email, config map[string]string) bool } type Email ¶ type Email struct { From From To []string Bcc []string Cc []string Subject string Text []byte // Plaintext message (optional) HTML []byte // Html message (optional) } type From ¶ type From struct { Address string Name string } type Mailer ¶ type Mailer struct { Driver Driver } func NewMailer ¶ func NewMailer() *Mailer NewMailer 单例模式获取 func (*Mailer) Send ¶ func (mailer *Mailer) Send(email Email) bool type SMTP ¶ type SMTP struct{} SMTP 实现 email.Driver interface func (*SMTP) Send ¶ func (s *SMTP) Send(email Email, config map[string]string) bool Send 实现 email.Driver interface 的 Send 方法 Source Files ¶ View all Source files driver_interface.go driver_smtp.go mail.go Click to show internal directories. Click to hide internal directories.