title: Nodemailer Invalid login: 451 4.7.0 Temporary server error
body: <p>I am trying to send an email from office 365 outlook account using oauth2</p>
  
  <p>but I am getting following error</p>
  
  <pre><code>Invalid login: 451 4.7.0 Temporary server error. Please try again later. PRX4  [MA1PR01CA0110.INDPRD01.PROD.OUTLOOK.COM]
  </code></pre>
  
  <p>Here is my code</p>
  
  <pre><code>let sendEmail: (accessToken) =&gt; {
      return new Promise((resolve, reject) =&gt; {
          let options = {
              "to": "xxx",
              "subject": "hello from nodemailer",
              "text": "Hello from nodemailer again"
              "from": 'xxx'
          }
          let transporter = nodemailer.createTransport({
              host: 'smtp.office365.com',
              port: 587,
              secure: true,
              auth: {
                  type: 'OAuth2',
                  user: options.from,
                  accessToken: accessToken
              },
              tls: { ciphers: 'SSLv3' }
          })
          transporter.sendMail(options, (err, info) =&gt; {
              return err ? reject(err) : resolve(info);
          })
      })
  }  
  </code></pre>
  
  <p>Also tried with <strong>port: 465</strong> but getting error</p>
  
  <pre><code>connect ETIMEDOUT 40.100.136.18:465
  </code></pre>
  
  <p>I have also given '<strong>Send mail as a user</strong>' permission while creating an access token.  </p>
  
  <p>Am I missing something? please suggest the solution.</p>