All Projects → admpub → mail

admpub / mail

Licence: Apache-2.0 license
Golang mail,支持SSL、NONE、LOGIN等登录方式,支持QQ企业邮箱

Programming Languages

go
31211 projects - #10 most used programming language

mail

Golang SMTP电子邮件包

安装

go get github.com/admpub/mail

例子

import (
  "fmt"
  "github.com/admpub/mail"
  "os"
)

func main() {
  conf := &mail.SMTPConfig{
      Username: "admpub",
      Password: "",
      Host:     "smtp.admpub.com",
      Port:     587,
      Secure:   "SSL",
  }
  c := mail.NewSMTPClient(conf)
  m := mail.NewMail()
  m.AddTo("[email protected]") //或 "老弟 <[email protected]>"
  m.AddFrom("[email protected]") //或 "老哥 <[email protected]>"
  m.AddSubject("Testing")
  m.AddText("Some text :)")
  filepath, _ := os.Getwd()
  m.AddAttachment(filepath + "/mail.go")
  if e := c.Send(m); e != nil {
    fmt.Println(e)
  } else {
    fmt.Println("发送成功")
  }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].