nodemailer throws error Invalid login: 534-5.7.14

sways picture sways · Aug 23, 2018 · Viewed 12.7k times · Source

I found this error while i'm trying to send an email from one Gmail account to another. How to solve this error ? Help me on it.

There were an error:

Invalid login: 534-5.7.14 Please log in via 534-5.7.14 your web browser and then try again. 534-5.7.14 Learn more at 534 5.7.14 https://support.google.com/mail/answer/78754 a90-v6sm7292588pfg.106 - gsmtp

I have already try Allow less secure apps to be ON but still same error. it working correctly when i run application on local machine but this error on server machine

Please help me

Answer

Shanil Arjuna picture Shanil Arjuna · Aug 23, 2018

You might need to allow access to your Gmail account.

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

Edit (after your comment)

// 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' 
    }
});

your 'nodemailer.createTransport' should look something similar.