dpi10335
2019-07-16 18:28
浏览 2.7k
已采纳

go-smtp,无法通过gmail发送电子邮件,获得EOF

I am using go-smtp to attempt to send an email to myself: https://github.com/emersion/go-smtp

    auth := sasl.NewPlainClient("", USERNAME, PASSWORD)
    to := []string{USERNAME}

    msg := strings.NewReader("To: " + USERNAME + "
" +
        "Subject: testing golang go-smtp!
" +
        "
" +
        "This is the email body.
")

    err := smtp.SendMail(SERVER_HOST + ":" + SERVER_PORT, auth, USERNAME, to, msg)
    if err != nil {
        log.Fatal(err)
    }

The output is: EOF exit status 1

I am connecting to smtp.gmail.com:465 and can send email through thunderbird okay.

Thanks for your help.

Walter

图片转代码服务由CSDN问答提供 功能建议

我正在使用go-smtp尝试向自己发送电子邮件: https://github.com/emersion/go-smtp </ p>

   auth:= sasl.NewPlainClient(“”,USERNAME,PASSWORD)
到:= [] string {USERNAME} 
 
 msg:= strings.NewReader(“ To:” + USERNAME +“ 
 
” +  
“主题:测试golang go-smtp!
 
” + 
“ 
 
” + 
“这是电子邮件正文。
 
”)
 
错误:= smtp。  Sender(SERVER_HOST +“:” + SERVER_PORT,auth,USERNAME,to,msg)
如果err!= nil {
 log.Fatal(err)
} 
 </ code> </ pre> 
 \  n 

输出为: EOF exit状态1 </ p>

我正在连接到smtp.gmail.com:465,可以通过雷鸟发送电子邮件。</ p>

感谢您的帮助。</ p>

沃尔特</ p> </ div>

1条回答 默认 最新

相关推荐 更多相似问题