title: I am getting this error when trying to send mails through nodemailer and gmail
body: <p>'535-5.7.8 Username and Password not accepted. Learn more at\n535 5.7.8  <a href="https://support.google.com/mail/?p=BadCredentials" rel="nofollow noreferrer">https://support.google.com/mail/?p=BadCredentials</a> x66sm1596680lff.64 - gsmtp' What can i do please. 
  I amm trying to integrate email messaging into my app, even after going through the Gmail API activation and retrieving the client_id and client_secret, it still doesn't work out.</p>
  
  <pre><code>let express = require('express')
  let formidable = require('formidable');
  let nodemailer = require('nodemailer');
  let router = express.Router();
  let app = express()
  
  app.use(express.static('dist'));
  app.use(express.static('public'));
  app.use('/email', router);
  router.get('/', handleSayHello);
  function handleSayHello(req, res){
      var transporter = nodemailer.createTransport({
          service: "Gmail",
              auth: {
              XOAuth2: {
              user: "mygmail@gmail.com", 
  
              clientId: "my-generated-OAuthId",
              clientSecret: "my-generated-OAuthSecret",
                  }
          }
      })
  
  
  
      var tex_t = `&lt;h1 style = "text-align: center"&gt;Hello Joshua&lt;/h1&gt;
              &lt;p&gt;How are you doing today&lt;/p&gt;  
      `;
      var mailOptions = {
          to : 'anotherUser@soso.com',
          from: 'anotherDifferentUser',
          subject: 'Email Example',
          html: tex_t,
      };
      transporter.sendMail(mailOptions, function(error, info){
          if(error){
              console.log(error);
              res.json({yo: 'error'});
          }else{
              console.log("Message sent: " + info.response);
              res.json({yo: info.response});
          };
      });
  
  }
  app.set('port', (process.env.PORT || 3000));
  app.listen(app.get("port"), ()=&gt;{
      console.log("App listening at ", app.get('port'));
  })
  </code></pre>