Sending an email using nodemailer not working on remote but working in local host
<p>Hello I am using nodemailer to send an email. It works fine on local host but it doesn't work when I deploy it to the remote website.</p>

<p>I get the following error message when I try to send an email on the remote website:</p>

<pre><code>ERROR ===  { Error: Invalid sender “&lt;Myemailaddress@gmail.com&gt;”
2016-08-15T05:05:01.034175+00:00 app[web.1]:     at SMTPConnection._formatError (/app/node_modules/smtp-connection/lib/smtp-connection.js:493:15)
2016-08-15T05:05:01.034175+00:00 app[web.1]:     at SMTPConnection._setEnvelope (/app/node_modules/smtp-connection/lib/smtp-connection.js:688:30)
2016-08-15T05:05:01.034176+00:00 app[web.1]:     at SMTPConnection.send (/app/node_modules/smtp-connection/lib/smtp-connection.js:364:10)
2016-08-15T05:05:01.034177+00:00 app[web.1]:     at SMTPTransport.&lt;anonymous&gt; (/app/node_modules/nodemailer-smtp-transport/lib/smtp-transport.js:126:24)
2016-08-15T05:05:01.034178+00:00 app[web.1]:     at /app/node_modules/nodemailer-smtp-transport/lib/smtp-transport.js:162:21
2016-08-15T05:05:01.034178+00:00 app[web.1]:     at SMTPConnection._actionAUTHComplete (/app/node_modules/smtp-connection/lib/smtp-connection.js:1185:5)
2016-08-15T05:05:01.034179+00:00 app[web.1]:     at SMTPConnection.&lt;anonymous&gt; (/app/node_modules/smtp-connection/lib/smtp-connection.js:307:22)
2016-08-15T05:05:01.034180+00:00 app[web.1]:     at SMTPConnection._processResponse (/app/node_modules/smtp-connection/lib/smtp-connection.js:634:16)
2016-08-15T05:05:01.034180+00:00 app[web.1]:     at SMTPConnection._onData (/app/node_modules/smtp-connection/lib/smtp-connection.js:458:10)



var nodemailer = require('nodemailer');
var transporter = nodemailer.createTransport({
  service: 'Mailgun',
  auth: {
    user: process.env.MAILGUN_USERNAME,
    pass: process.env.MAILGUN_PASSWORD
  }
});

/**
 * 
 */
exports.contact = function(from, to) {

  var mailOptions = {
    from: from.name + ' ' + '&lt;'+ from.email + '&gt;',
    to: to.email,
    subject: from.subject || "No Subject",
    text: from.message
  };

  transporter.sendMail(mailOptions, function(err) {
    if (err){
      console.log("ERROR === ", err);
    }
  });
};
</code></pre>

<p>I have already given access for my email address for less secure apps so that should not be the problem. Does anyone know why it would work on the local website but not the remote website?</p>