Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

README.md

Mail 【golang send mail package】

 Mail: send mail support AUTH:

  • LOGIN : mail.LoginAuth(email.Username, email.Password)
  • CRAM-MD5: smtp.CRAMMD5Auth(email.Username, email.Password)
  • PLAIN : smtp.PlainAuth(email.Identity, email.Username, email.Password, email.Host)
  • NTLM: mail.NTLMAuth(email.Host, email.Username, email.Password, mail.NTLMVersion1) # mail.NTLMVersion2 也支持

Mail: send mail support Secure:

  • SSL
  • TLS
  • 非安全加密

Mail: Use github.com/farmerx/mail

email := NewEMail(`{"port":25}`)
email.From = `farmerx@163.com`
email.Host = `smtp.163.com`
email.Port = int(25) // [587 NTLM AUTH] [465,994]
email.Username = `Farmerx`
email.Secure = `` // SSL,TSL
email.Password = `************`
authType := `LOGIN`
switch authType {
case ``:
	email.Auth = nil
case `LOGIN`:
	email.Auth = LoginAuth(email.Username, email.Password)
case `CRAM-MD5`:
	email.Auth = smtp.CRAMMD5Auth(email.Username, email.Password)
case `PLAIN`:
	email.Auth = smtp.PlainAuth(email.Identity, email.Username, email.Password, email.Host)
case `NTLM`:
	email.Auth = NTLMAuth(email.Host, email.Username, email.Password, NTLMVersion1)
default:
	email.Auth = smtp.PlainAuth(email.Identity, email.Username, email.Password, email.Host)
}

email.To = []string{`farmerx@163.com`}
email.Subject = `send mail success`
email.Text = "尊敬的用户:\r\n   您好,附件中是您订阅的报表,请注意查收。"
//email.AttachFile(reportFile)
if err := email.Send(); err != nil {
      fmt.Println(err)
}

回首向来潇洒处, 归去. 也无风雨也无晴

 

About

golang send mail with SSL,TLS and support NTLM,LOGIN,PLAIN AUTH...

Topics

Resources

Releases

No releases published

Packages

No packages published

Languages

You can’t perform that action at this time.