package main //cmd: go get gopkg.in/gomail.v1 import (
"gopkg.in/gomail.v1"
) func main() {
msg := gomail.NewMessage()
msg.SetHeader("From", "xxx@163.com")
msg.SetHeader("To", "zzzzzzz@qq.com", "xxx@163.com")
//msg.SetAddressHeader("Cc", "dan@example.com", "Dan")
msg.SetHeader("Subject", "Hello!")
msg.SetBody("text/html", "Hello <b>Bob</b> and <i>Cora</i>!") f, err := gomail.OpenFile("C:/Documents and Settings/yan/My Documents/My Pictures/old/bg.jpg")
if err != nil {
panic(err)
}
msg.Attach(f) //smtp.163.com:25
mailer := gomail.NewMailer("smtp.163.com", "xxx@163.com", "xxxxxxx", )
if err := mailer.Send(msg); err != nil {
panic(err)
}
}