nodemailer引发错误无效登录:534-5.7.14

swa*_*ays 4 node.js nodemailer

我尝试将电子邮件从一个Gmail帐户发送到另一个帐户时发现了此错误。如何解决这个错误?帮助我。

发生错误:

无效的登录:534-5.7.14请通过网络浏览器534-5.7.14登录,然后重试。534-5.7.14进一步了解534 5.7.14 https://support.google.com/mail/answer/78754 a90-v6sm7292588pfg.106-gsmtp

我已经尝试过允许安全性较低的应用打开, 但仍然存在相同的错误。当我在本地计算机上运行应用程序但在服务器计算机上出现此错误时,它可以正常工作

请帮我

小智 21

 If you use GMAIL service as a transporter,
 
 Step-1: Log in to your gmail account.
 Step-2: Enable less secure app access and/or DisplayUnlockCaptcha on 
         your gmail account.
 Step-3: Follow a 6-step guide on 
         https://support.google.com/accounts/answer/185833?hl=en
 Step-4: Replace your transporter password with the 16-character generated app 
         password you obtain from Step-3 above.   

         These four easy steps solved my problem. Feel free to leave a reply message, 
         if you get stuck, I'm happy to assist you. Otherwise, if this helped you in 
         any way, go ahead and vote my answer "This answer was useful. Best wishes!!!
 
Run Code Online (Sandbox Code Playgroud)


Sha*_*una 8

您可能需要允许访问您的Gmail帐户。

https://accounts.google.com/b/0/DisplayUnlockCaptcha

编辑(发表评论后)

//使用默认的SMTP传输创建可重用的传输器对象

transporter = nodemailer.createTransport({
    host: 'smtp.gmail.com',
    port: 465,
    secure: true, 
    auth: {
        user: 'yourEmail', 
        pass: 'yourPassword' 
    }
});
Run Code Online (Sandbox Code Playgroud)

您的“ nodemailer.createTransport”应该看起来类似。

  • 我尝试了这个解决方案。它可以工作几个小时。但 gmail 再次开始阻止邮件发送请求。 (4认同)
  • 尝试上面的代码片段,但在本地机器正常工作时出现相同的错误。服务器机器上的问题 (2认同)
  • 你也尝试过这个 https://accounts.google.com/b/0/DisplayUnlockCaptcha 吗? (2认同)