使用Node JS使用Outlook SMTP发送电子邮件



我正在尝试使用NodeMailer软件包发送电子邮件。我遇到不同的错误可能是因为TLS的配置设置错误。我的Outlook SMTP使用了StartTL,但我不知道如何使用它。我已经为Gmail成功配置了它,但是在使用Outlook实现时会出现错误。请解释或举一个例子。我已经谷歌搜索了2天,但无法得到它。谢谢。

代码片段如下:

const transporter = nodeMailer.createTransport({
    host: 'smtp.office365.com',
    service:'office365',
    port: 587,
    secure: false,  //true for 465 port, false for other ports
    auth: {
      user: 'kuxxxxxxxxxxxxin',
      pass: 'Mxxxxxxxx3'
    },      
    secureConnection: false,
    tls: {
        ciphers: 'SSLv3',
        rejectUnauthorized: true
    }
});

Office 365由于IT安全性漏洞而不再支持SSL V3。您必须至少使用TLS 1.2

相关内容

最新更新