英文:
Gmail: 530 5.5.1 Authentication Required. Learn more at
问题
这个Go程序可以成功地从我的家用电脑发送电子邮件,但在DigitalOcean的虚拟服务器上收到以下错误:
panic: 530 5.5.1 需要身份验证。了解更多信息请访问
以下是代码:
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) }
英文:
This Go program successfully sends email from my home computer, but on a virtual server on DigitalOcean receives the following error:
panic: 530 5.5.1 Authentication Required. Learn more at
Here's the code:
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) }
答案1
得分: 39
转到您的Gmail帐户的安全设置,并将“较不安全的应用程序”的权限设置为启用。对我有用。
英文:
Get to your Gmail account's security settings and set permissions for "Less secure apps" to Enabled.
Worked for me.
答案2
得分: 13
Derp!我登录到账户后,页面顶部出现了一个“可疑登录尝试”警告消息。点击警告并授权访问后,一切正常。
英文:
Derp! I signed into the account and there was a "Suspicious login attempt" warning message at the top of the page. After clicking the warning and authorizing the access, everything works.
答案3
得分: 8
你需要前往https://security.google.com/settings/security/apppasswords,然后选择Gmail,再选择设备。然后点击生成。只需复制并粘贴由Google生成的密码即可。
英文:
You need to go here https://security.google.com/settings/security/apppasswords
then select Gmail and then select device. then click on Generate. Simply Copy & Paste password which is generated by Google.
答案4
得分: 0
你需要在你正在使用的邮箱的设置中打开POP邮件和IMAP邮件功能。
祝你好运!
英文:
You need turn on the POP mail and IMAP mail feature in setting of the email you are using to send mail.
Good luck!
答案5
得分: 0
在我的情况下,将SMTPAuth设置为true可以解决问题。当然,您需要将"Less secure apps"的权限设置为启用。
$mail->SMTPAuth = true;
英文:
in may case setting SMTPAuth to true fixed it. Of-course you need to set permissions for "Less secure apps" to Enabled.
$mail->SMTPAuth = true;
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论