NodeMailer Invalid Login

I am new to node.js programming .I am using nodemailer module for sending emails.

const nodemailer = require ('nodemailer'),
var mailTransport=nodemailer.createTransport({
    auth: {
        user :,
        pass :,
function sendMail(mail_id){
        from: ' "my name" <>',
        to : mail_id,   //
        subject : 'Hello',
        text: "Hello How do u do ?",
            console.log('Unable to send the mail :'+err.message);
            console.log('Message response : '+info.response);

This is my program for sending emails to different users. But I am getting Invalid Login . I don't have any idea why this is coming . I am new to node.js and server side scripting. I am using my gmail username and password for credentials. Please help me.


Did you double-check your login credentials? Also did you double-check your "from" adress to match your email?

I used the nodemailer for some tests 3 weeks ago with the gmail example given on the github page and it worked like a charm:

Invalid login indicates mistyped/wrong credentials.

One reason could be the 'modern security standard' protection from Gmail.

Check you gmail inbox for any new mail having subject "Google Account: sign-in attempt blocked"

If yes, open the mail and click on the link

set 'Access for less secure apps' to 'Turn on'. Try again, it should be working now.

U need to Enable Security for Apps :

|*| If u r using gmail,

Use :

    service: 'gmail',

Goto :

Enable : 

    Allow less secure apps: ON

|*| If u r using yahoo,

Use :

    service: 'yahoo',

Goto :

Enable : 

    Allow apps that use less secure sign in

|*| If u r using Live or Hotmail, No need to enable anything.

Use :

    service: 'hotmail',

Particularly 2 issues: or you don't have enabled Less Secure Apps or you don't have enabled Display Unlock Captcha, you need to turn on both of them.

Need Your Help

Setting ID for Spinner items

android spinner

I have an array of Strings I'm populating a Spinner object with. However, I'd like to attach an ID to each element of the Spinner, so when the user selects an item, I have its ID to use to save to...