Git Product home page Git Product logo

mail's Introduction

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 = `[email protected]`
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{`[email protected]`}
email.Subject = `send mail success`
email.Text = "尊敬的用户:\r\n   您好,附件中是您订阅的报表,请注意查收。"
//email.AttachFile(reportFile)
if err := email.Send(); err != nil {
      fmt.Println(err)
}

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

 

mail's People

Contributors

farmerx avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.