Skip to content

Latest commit

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

mail

Golang SMTP电子邮件包

安装

gogetgithub.com/admpub/mail

例子

import (
"fmt""github.com/admpub/mail""os"
)
funcmain() {
conf:=&mail.SMTPConfig{
Username: "admpub",
Password: "",
Host: "smtp.admpub.com",
Port: 587,
Secure: "SSL",
}
c:=mail.NewSMTPClient(conf)
m:=mail.NewMail()
m.AddTo("hello@admpub.com") //或 "老弟 <hello@admpub.com>"m.AddFrom("hank@admpub.com") //或 "老哥 <hank@admpub.com>"m.AddSubject("Testing")
m.AddText("Some text :)")
filepath, _:=os.Getwd()
m.AddAttachment(filepath+"/mail.go")
ife:=c.Send(m); e!=nil {
fmt.Println(e)
} else {
fmt.Println("发送成功")
}
}

About

Golang mail,支持SSL、NONE、LOGIN等登录方式,支持QQ企业邮箱

Resources

Stars

24 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages