title: Nodemailer failing on live server
body: <p>Whenever I try to send an email from my server running locally it works without issue however, it fails in production environment.</p>
  
  <p>Here is the log file:</p>
  
  <pre><code>at SMTPConnection._actionAUTHComplete (/home/7278/mailsender/node_modules/nodemailer/lib/smtp-connection/index.js:1335:34)
      at SMTPConnection._responseActions.push.str (/home/7278/mailsender/node_modules/nodemailer/lib/smtp-connection/index.js:1293:18)
      at SMTPConnection._processResponse (/home/7278/mailsender/node_modules/nodemailer/lib/smtp-connection/index.js:762:20)
      at SMTPConnection._onData (/home/7278/mailsender/node_modules/nodemailer/lib/smtp-connection/index.js:558:14)
      at TLSSocket._socket.on.chunk (/home/7278/mailsender/node_modules/nodemailer/lib/smtp-connection/index.js:709:51)
      at TLSSocket.emit (events.js:182:13)
      at TLSSocket.EventEmitter.emit (domain.js:442:20)
      at addChunk (_stream_readable.js:283:12)
      at readableAddChunk (_stream_readable.js:264:11)
      code: 'EAUTH',   
      response:
            '535 5.7.3 Authentication unsuccessful [YTOPR0101CA0050.CANPRD01.PROD.OUTLOOK.COM]',   responseCode: 535,   command: 'AUTH LOGIN' }
  
  { Error: Invalid login: 535 5.7.3 Authentication unsuccessful [YTXPR0101CA0004.CANPRD01.PROD.OUTLOOK.COM]
      at SMTPConnection._formatError (/home/7278/mailsender/node_modules/nodemailer/lib/smtp-connection/index.js:606:19)
      at SMTPConnection._actionAUTHComplete (/home/7278/mailsender/node_modules/nodemailer/lib/smtp-connection/index.js:1335:34)
      at SMTPConnection._responseActions.push.str (/home/7278/mailsender/node_modules/nodemailer/lib/smtp-connection/index.js:1293:18)
      at SMTPConnection._processResponse (/home/7278/mailsender/node_modules/nodemailer/lib/smtp-connection/index.js:762:20)
      at SMTPConnection._onData (/home/7278/mailsender/node_modules/nodemailer/lib/smtp-connection/index.js:558:14)
      at TLSSocket._socket.on.chunk (/home/7278/mailsender/node_modules/nodemailer/lib/smtp-connection/index.js:709:51)
      at TLSSocket.emit (events.js:182:13)
      at TLSSocket.EventEmitter.emit (domain.js:442:20)
      at addChunk (_stream_readable.js:283:12)
      at readableAddChunk (_stream_readable.js:264:11)
    code: 'EAUTH',
    response:
     '535 5.7.3 Authentication unsuccessful [YTXPR0101CA0004.CANPRD01.PROD.OUTLOOK.COM]',
    responseCode: 535,
    command: 'AUTH LOGIN' }
  </code></pre>
  
  <p>Here is the code for the node.js server:</p>
  
  <pre><code>#!/usr/bin/env node
  const http = require("http");
  const url = require('url');
  const nodemailer = require('nodemailer');
  
  const transporter = nodemailer.createTransport({
    service: 'Hotmail',
  
    auth: {
      user: 'my email',
      pass: 'my password'
    },
  
  });
  
  const server = http.createServer(function (req, res) {
      //console.log(res.getHeader("Message-Author"));
      //Parse the address:
      var q = url.parse(req.url, true);
  
      /*The parse method returns an object containing url properties*/
      /*The query property returns an object with all the querystring parameters as properties:*/
      var qdata = q.query;
      /*console.log(qdata.name);
      console.log(qdata.email);
      console.log(qdata.subject);
      console.log(qdata.message);*/
  
      var mailOptions = {
        from: 'my email',
        to: 'my email',
        subject: '['+qdata.name+', '+qdata.email+']'+qdata.subject,
        text: '[tag]\n\n'+qdata.message
      }; 
  
      transporter.sendMail(mailOptions, function(error, info){
        if (error) {
          console.log(error);
        } else {
          console.log('Email sent: ' + info.response);
        }
      });
  
      res.writeHead(302, {
          'Location': 'url here'
      });
      res.end();
  });
  
  server.listen(80, (err) =&gt; {
      if ( ! err) {
          console.log(`server is listening on 80`)
      }
  })
  </code></pre>
  
  <p>I don't know why it would connect and send the email fine when running locally but then tell me that the <code>Authentication unsuccessful</code> when the server is live. Any help/pointers will be appreciated.</p>