title: Node.js nodemailer error - wrong version number/invalid greeting
body: <p>I have a big problem with setting up the nodemailer on my node.js server. Tried everthing I found on the internet but nothing works. The only thing that was easy to setup was the gmail service. but unfortunately I cannot use that one.</p>
  <p>With <strong>secure</strong> set to <strong>true</strong>, i get an ssl error with the reason <strong>wrong version code</strong>.</p>
  <pre><code>[Error: 22468:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:c:\ws\deps\openssl\openssl\ssl\record\ssl3_record.c:332:
  ] {
    library: 'SSL routines',
    function: 'ssl3_get_record',
    reason: 'wrong version number',
    code: 'ESOCKET',
    command: 'CONN'
  }
  </code></pre>
  <p>But when I try to set <strong>secure</strong> to <strong>false</strong>, then I get an <strong>invalid greeting error</strong>.</p>
  <pre><code>Error: Invalid greeting. response=* OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA ACL ACL2=UNION STARTTLS] Courier-IMAP ready. Copyright 1998-2016 Double Precision, Inc.  See COPYING for distribution information.: * OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA ACL ACL2=UNION STARTTLS] Courier-IMAP ready. Copyright 1998-2016 Double Precision, Inc.  See COPYING for distribution information.
      at SMTPConnection._actionGreeting (C:\Users\Motiondata\Documents\repos\rmn_app\server\rmn_server\node_modules\nodemailer\lib\smtp-connection\index.js:1189:27)
      at SMTPConnection._processResponse (C:\Users\Motiondata\Documents\repos\rmn_app\server\rmn_server\node_modules\nodemailer\lib\smtp-connection\index.js:932:20)
      at SMTPConnection._onData (C:\Users\Motiondata\Documents\repos\rmn_app\server\rmn_server\node_modules\nodemailer\lib\smtp-connection\index.js:739:14)
      at Socket.SMTPConnection._onSocketData (C:\Users\Motiondata\Documents\repos\rmn_app\server\rmn_server\node_modules\nodemailer\lib\smtp-connection\index.js:189:44)
      at Socket.emit (events.js:315:20)
      at addChunk (_stream_readable.js:309:12)
      at readableAddChunk (_stream_readable.js:284:9)
      at Socket.Readable.push (_stream_readable.js:223:10)
      at TCP.onStreamRead (internal/stream_base_commons.js:188:23) {
    code: 'EPROTOCOL',
    response: '* OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA ACL ACL2=UNION STARTTLS] Courier-IMAP ready. Copyright 1998-2016 Double Precision, Inc.  See COPYING for distribution information.',
    command: 'CONN'
  }
  </code></pre>
  <p>My code is the following:</p>
  <pre><code>const transporter = nodemailer.createTransport({
    host: process.env.MAIL_HOST, // mx.example.com
    port: process.env.MAIL_PORT, // 143
    secure: true,
    auth: {
      user: process.env.MAIL_ADDRESS,
      pass: process.env.MAIL_PWD
    }
  })
  </code></pre>
  <p>I checked the credentials a thousand time, they are definetly not the problem.</p>
  <p>Hope anyone can help me.
  Thanks in advance.</p>