最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

nodemailer在Aws Ec2上的生产环境中导致错误

运维笔记admin9浏览0评论

nodemailer在Aws Ec2上的生产环境中导致错误

nodemailer在Aws Ec2上的生产环境中导致错误

我使用nodemailer使用node.js发送电子邮件,我有这个配置发送电子邮件

var transporter = nodemailer.createTransport({
            service: 'gmail',
            host: 'smtp.gmail',
            auth: {
                user: '[email protected]',
                pass: 'password'
            }
        });
 const mailOptions = {
            from: '[email protected]', // sender address
            to: userpany_email, // list of receivers
            subject: 'EnStream New Account Signup Password', // Subject line
            html: `<p style="font-size : 15px;">Please sing in to your en-stream account here <a href="">;/a> with this password : ${userPassword}</p>`// plain text body
        };

它正确地发送本地环境的电子邮件,但在Aws Ec2的生产环境中,它会抛出此错误

code: "EAUTH"
command: "AUTH PLAIN"
response: "534-5.7.14 <;scc=1&plt=AKgnsbua↵534-5.7.14 qup7zOOL4GtmYEf1HEHBASSSBgbuMNJRQqK2v3X9mcxDRX1SrXU2Y_LSqZm7Y7yJvH2PwL↵534-5.7.14 JZW6iSXxsRhBdntFAAamrvitpdKS_YJiE-pEnXWakITAz1PAzwDMxjJPKntQrLl2Qx-xA1↵534-5.7.14 zZ4aTvKvYOAk85YHwABnnd0wHU2HkUeHPoDYqgXUWgSA_8Rrn4xkIsUN> Please log↵534-5.7.14 in via your web browser and then try again.↵534-5.7.14  Learn more at↵534 5.7.14   a11sm34494120wrx.5 - gsmtp"
responseCode: 534

我允许在我的ec2实例安全组中使用出站端口465

这有什么真正的问题?

回答如下:

您可能需要Gmail的许可。

你必须启用Allow access to your Google Account。

脚步:

  1. 通过您尝试登录的同一浏览器转到此链接。
  2. 它会询问“允许访问您的Google帐户”。单击“继续”按钮。
  3. 将显示“已启用帐户访问”消息。

此外,必须允许设置“Less Secure Apps”。点击此链接:https://myaccount.google/lesssecureapps。

如果问题仍然存在,请检查Gmail是否阻止了您的服务器IP。

这应该有帮助!

发布评论

评论列表(0)

  1. 暂无评论