title: Nodemailer doesn't send emails, and doesn't return an error message
body: <p>I would like to know why nodemailer isn't sending emails, but it isn't returning any errors so I don't know what to do. Here's my code (pretty much copied from the nodemailer documentation):</p>
  
  <pre><code>var cors = require('cors');
  var corsOptions = {
      origin: 'http://davidmichael.me',
      allowedHeaders: 'accept, content-type',
      methods: 'GET, POST'
  };
  
  var nodemailer = require('nodemailer');
  
  module.exports = function(app){
      app.options('/email', cors(corsOptions));
      app.post('/email', cors(corsOptions), function(req, res){
          var transporter = nodemailer.createTransport({
              service: 'Gmail',
              auth: {
                  user: 'my-email',
                  pass: 'my-password'
              }
          });
  
          var mailOptions = {
              from: 'David Michael &lt;my-email&gt;',
              to: 'recipient-email',
              subject: 'Just verifying your email address ✔',
              text: 'Hello to myself!',
              html: '&lt;p&gt;&lt;b&gt;Hello&lt;/b&gt; to myself&lt;/p&gt;'
          };
          var emailMessage = "";
  
          transporter.sendMail(mailOptions, function(error, info){
              if(error){
                  emailMessage = "there was an error :-(, and it was this: " + error.message;
              }else{
                  emailMessage = "Message sent: " + info.response;
              }
          });
          //transporter.close();
          return res.json({
              message: "success",
              email: emailMessage
          });
      });
  };
  </code></pre>
  
  <p>Every time I try it, it successfully returns the JSON object at the end as follows:</p>
  
  <pre><code>{"message":"success","email":""}
  </code></pre>
  
  <p>Perhaps I should note that I am using CORS because I want to take the user's email address. My client-side app sends a HTTP POST request with a JSON object containing their email address -- however, the current code doesn't do anything with that yet. I want to get the basic mechanism working first.</p>
  
  <p>I am using Openshift. Could that make a difference? </p>
  
  <p>Also, I have tried using non-Gmail email addresses, and the same thing happens.</p>
  
  <p>Any ideas about where I'm going wrong?</p>