这个 Go 程序成功地从我的家用计算机发送电子邮件,但在 DigitalOcean 上的虚拟服务器上收到以下错误:
panic: 530 5.5.1 Authentication Required. Learn more at
这是代码:
auth := smtp.PlainAuth("", "bjorkbjorksen@gmail.com", "PASSWORD", "smtp.gmail.com")
msg := "Subject: Hello\r\n\r\nWorld!"
e = smtp.SendMail("smtp.gmail.com:587", auth, "bjorkbjorksen@gmail.com", []string{email}, []byte(msg))
if e != nil { panic(e) }