title: Nodemailer - MS Exchaneg server - Error unable to verify the first certificate
body: <p>I am trying to send email from NodeJS using out office MS Exchange Mail server. with below code. And get error </p>
  
  <p>Our Admin said no certificates are needed.</p>
  
  <p><strong>Error:-</strong></p>
  
  <pre><code>$ node test2.js
  Error :  { Error: unable to verify the first certificate
      at TLSSocket.onConnectSecure (_tls_wrap.js:1048:34)
      at TLSSocket.emit (events.js:182:13)
      at TLSSocket._finishInit (_tls_wrap.js:628:8) code: 'ESOCKET', command: 'CONN' }
  </code></pre>
  
  <p><strong>NodeJS Code:-</strong></p>
  
  <pre><code>"use strict";
  const nodemailer = require("nodemailer");
  
  async function main() {
      try {
          // create reusable transporter object using the default SMTP transport
          let transporter = nodemailer.createTransport({
              host: 'host',
              port: 25,
              secure : false, // true for 465, false for other ports
              auth: {
                  user: 'user',
                  pass: 'password'
              }
          });
  
          // setup email data
          let mailOptions = {
              from: 'me@email.com',
              to: 'me@email.com',
              subject: 'Hey you, awesome!',
              html: '&lt;b&gt;This is bold text&lt;/b&gt;',
              text: 'This is text version!'
          };
  
          // send mail with defined transport object
          let info = await transporter.sendMail(mailOptions)
          console.log("Message sent: %s", JSON.stringify(info));
  
      } catch (error) {
          console.log('Error : ', error);
      }
  }
  
  main(); // For testing
  </code></pre>