简体   繁体   中英

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 }

You may need to " Allow Less Secure Apps " in your Gmail account (it's all the way at the bottom). You also may need to " Allow access to your Google account ".

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....

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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