go 發送郵件

email 模塊

func SendMail(i int, err error) {
    e := email.NewEmail()
    e.From = "zj <[email protected]>"
    e.To = []string{"[email protected]"}
    e.Subject = "接口報錯信息"
    e.Text = []byte(Product[i] + "報錯" + ", 報錯信息" + err.Error() )
    e.Cc = []string{"[email protected]", "[email protected]"}
    p := smtp.PlainAuth("", "[email protected]", "jmyfqtusecdjbced", "smtp.qq.com")
    err = e.Send("smtp.qq.com:25", p)
    if err != nil {
        log.Fatal(err)
        fmt.Println(err)
    }
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章