代码语言:javascript复制
package main
import (
"fmt"
"net/smtp"
)
func main() {
auth := smtp.PlainAuth("text/plain", "fyxichen@163.com", "123456", "smtp.163.com")
to := []string{"123456@qq.com"}
msg := []byte(`To:123456@qq.com
From:czxichen@163.com
Subject:测试
Content-Type: text/plain;
charset=UTF-8"
this is test mail`)
err := smtp.SendMail("smtp.163.com:25", auth, "fyxichen@163.com", to, msg)
fmt.Println(err)
} </pre>