title: I get a error "{ Error: Invalid login: 535-5.7.8 Username and Password not accepted." when I try send a mail with the module nodemailer from Node JS
body: <p>I am new in Node js and I try send a message like example to other e-mail and when I run the file in the terminal from linux I get this error:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>root@me:/home/memee/Desktop/test/NodeJS/mail# nano example.js
  root@me:/home/memee/Desktop/test/NodeJS/mail# node example.js
  { Error: Invalid login: 535-5.7.8 Username and Password not accepted. Learn more at
  535 5.7.8  https://support.google.com/mail/?p=BadCredentials 77-v6sm41437784pga.40 - gsmtp
      at SMTPConnection._formatError (/home/memee/Desktop/test/NodeJS/mail/node_modules/nodemailer/lib/smtp-connection/index.js:606:19)
      at SMTPConnection._actionAUTHComplete (/home/memee/Desktop/test/NodeJS/mail/node_modules/nodemailer/lib/smtp-connection/index.js:1335:34)
      at SMTPConnection._responseActions.push.str (/home/memee/Desktop/test/NodeJS/mail/node_modules/nodemailer/lib/smtp-connection/index.js:366:26)
      at SMTPConnection._processResponse (/home/memee/Desktop/test/NodeJS/mail/node_modules/nodemailer/lib/smtp-connection/index.js:762:20)
      at SMTPConnection._onData (/home/memee/Desktop/test/NodeJS/mail/node_modules/nodemailer/lib/smtp-connection/index.js:558:14)
      at TLSSocket._socket.on.chunk (/home/memee/Desktop/test/NodeJS/mail/node_modules/nodemailer/lib/smtp-connection/index.js:510:47)
      at emitOne (events.js:116:13)
      at TLSSocket.emit (events.js:211:7)
      at addChunk (_stream_readable.js:263:12)
      at readableAddChunk (_stream_readable.js:250:11)
    code: 'EAUTH',
    response: '535-5.7.8 Username and Password not accepted. Learn more at\n535 5.7.8  https://support.google.com/mail/?p=BadCredentials 77-v6sm41437784pga.40 - gsmtp',
    responseCode: 535,
    command: 'AUTH PLAIN' }</code></pre>
  </div>
  </div>
  </p>
  
  <p>I understand that my error is the login but my password and email is correct.</p>
  
  <p>My code :</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var nodemailer = require('nodemailer');
  
  var transporter = nodemailer.createTransport({
    service: 'gmail',
    auth: {
      user: 'example@gmail.com',
      pass: 'here I put my password'
    }
  });
  
  var mailOptions = {
    from: 'from@gmail.com',
    to: 'to@gmail.com',
    subject: 'Sending Email using Node.js',
    text: 'That was easy!'
  };
  
  transporter.sendMail(mailOptions, function(error, info){
    if (error) {
      console.log(error);
    } else {
      console.log('Email sent: ' + info.response);
    }
  });</code></pre>
  </div>
  </div>
  </p>
  
  <p>my version of node and npm :</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>root@me:~# node --version
  v8.11.3
  root@me:~# npm --v
  6.1.0
  root@me:~# </code></pre>
  </div>
  </div>
  </p>
  
  <p>I used this tutorial :<a href="https://www.w3schools.com/nodejs/nodejs_email.asp" rel="noreferrer">tutorial</a></p>