title: NodeMailer queuing outgoing email, but email never sends
body: <p>I'm trying to send an email from my own domain without using an external SMTP server. I'm using <a href="https://nodemailer.com/extras/smtp-connection/" rel="nofollow noreferrer">NodeMailer's SMTP connection</a>:</p>
  
  <pre><code>let options = {
      secure: true,
      port: consts.portOut,//465
      host: consts.host, //mydomain.com
      transactionLog: true,
      debug: true,
      requireTLS: true,
      authMethod: 'PLAIN',
  };
  
  let connection = new SMTPConnection(options);
  
  connection.connect(function() {
      let auth = {
          user: 'abc',
          pass: 'def'
      };
  
      connection.login(auth, function(err) {
          if (err) {
              console.log("Authentication failed!", err);
          }
          console.log("Authentication to SMTP server successful.");
  
          let envelope = {
              from: 'fee@mydomain.com',
              to: 'myemail@gmail.com'
          };
  
          let message = 'message hello world';
  
          connection.send(envelope, message, function(err, info) {
              if (err) {
                  console.log("err:::", err);
              } else {
                  console.log('info?', info);
                  //connection.quit();
              }
          });
  
          connection.quit();
  
      });
  
  });
  
  connection.on("error", function(err) {
      console.log(err);
  });
  </code></pre>
  
  <p>My server code using <a href="https://nodemailer.com/extras/smtp-server/" rel="nofollow noreferrer">NodeMailer's SMTP Server</a>: </p>
  
  <pre><code>const options = {
      secure: true,
      size: 25000000, //25MB
      authMethods: ['PLAIN'],
      key: hskey,
      cert: hscert,
      ca: [hschain],
      onAuth(auth, session, callback) {
          if(auth.username !== 'abc' || auth.password !== 'def') {
              return callback(new Error('Invalid username or password'));
          }
          callback(null, {user: 123}); // where 123 is the user id or similar property
      },
      onConnect(session, callback) {
          console.log("the address is:", session.remoteAddress)
          if (session.remoteAddress === consts.ip) {
              return callback(); // Accept the address
          } else {
              return callback(new Error('Only connections from %s allowed', consts.ip));
          }
  
      },
      onData(stream, session, callback) {
          simpleParser(stream, (err, parsed) =&gt; {
              if(err) {
                  console.error(err);
              } else {
                  console.log(parsed);
              }
  
          });
          stream.on('end', function () {
              let err;
              if(stream.sizeExceeded){
                  err = new Error('Message exceeds fixed maximum message size');
                  err.responseCode = 552;
                  return callback(err);
              }
              callback(null, 'Message queued as abcdef');
          });
      }
  
  };
  
  const emailServer = new SMTPServer(options);
  
  emailServer.listen(consts.portOut, function () {
      processSMTPConnection(consts, hskey);
  });
  
  emailServer.on("error", function (err) {
      console.error("Error %s", err.message);
  });
  </code></pre>
  
  <p>So after my client connects to my local SMTP server, the last message I get is 'Message queued as abcdef' and nothing ever sends (nothing ever arrives in my gmail inbox or any other email testing services)...</p>
  
  <p>No incorrect ports are blocked, so I must be missing something(?).
  Is this not how to correctly use NodeMailer? 
  Should I be able to send emails from my local domain using NodeMailer? </p>