简体   繁体   English

Nodemailer 使用 gmail 帐户发送邮件,显示响应代码 534-5.7.14

[英]Nodemailer send mail using gmail account showing response code 534-5.7.14

// create reusable transporter object using the default SMTP transport

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

{ [Error: Invalid login] code: 'EAUTH', response: '534-5.7.14 Please log in via your web browser and\n534-5.7.14 then try again.\n534-5.7.14 Learn more at n534 5.7.14 https://support.google.com/mail/answer/78754 77sm13524842wml.20 - g smtp', responseCode: 534 } { [错误:无效登录] 代码:'EAUTH',响应:'534-5.7.14 请通过您的 web 浏览器登录,然后\n534-5.7.14 然后重试。\n534-5.7.14 在 n534 5.7 了解更多信息.14 https://support.google.com/mail/answer/78754 77sm13524842wml.20 - g smtp', responseCode: 534 }

You may need to " Allow Less Secure Apps " in your Gmail account (it's all the way at the bottom).您可能需要在您的 Gmail 帐户中“允许不太安全的应用程序”(一直在底部)。 You also may need to " Allow access to your Google account ".您可能还需要“允许访问您的 Google 帐户”。

var transporter = nodemailer.createTransport(smtpTransport({
    host: config.email_config.SMTP_HOST,
    port: config.email_config.SMTP_PORT,
    tls: {
        rejectUnauthorized: false
    },
    auth: {
        user: config.email_config.SMTP_AUTH_USER,
        pass: config.email_config.SMTP_AUTH_PASS
    }
}));

use like thiss....

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM