Categorygithub.com/admpub/mail
modulepackage
0.0.0-20170408110349-d63147b0317b
Repository: https://github.com/admpub/mail.git
Documentation: pkg.go.dev

# README

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("发送成功")
  }
}

# Functions

LoginAuth loginAuth方式认证.
No description provided by the author
NewMail returns a new Mail.
No description provided by the author
SendMail 发送电邮.

# Structs

No description provided by the author
Mail will represent a formatted email.
SMTPClient struct.
SMTPConfig 配置结构体.