1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
package main
import ( "fmt" "net/smtp" "strings" )
func () { auth := smtp.PlainAuth("", "[email protected]", "password", "smtp.qq.com") to := []string{"[email protected]"} nickname := "test" user := "[email protected]" subject := "test mail" content_type := "Content-Type: text/plain; charset=UTF-8" body := "This is the email body." msg := []byte("To: " + strings.Join(to, ",") + "rnFrom: " + nickname + "<" + user + ">rnSubject: " + subject + "rn" + content_type + "rnrn" + body) err := smtp.SendMail("smtp.qq.com:25", auth, user, to, msg) if err != nil { fmt.Printf("send mail error: %v", err) } }
|
近期评论