小编Jua*_*sla的帖子

如何使用 Nodemailer 发送包含我公司域的电子邮件?

这是我的代码:我尝试使用 Outlook 帐户

const transporter = nodemailer.createTransport({
  host: 'smtp.office365.com',
  auth: {
    user: 'account@mycompanydomain.com',
    pass: 'password'
  }
});

transporter.verify(function(error, success) {
  if (error) {
    console.log(error);
  } else {
    console.log('Server is ready to take our messages');
  }
});
Run Code Online (Sandbox Code Playgroud)

我不确定这里出了什么问题。这些是 Nodemailer 日志:

[2020-03-17 09:55:34] DEBUG Creating transport: nodemailer (6.4.5; +https://nodemailer.com/; SMTP/6.4.5[client:6.4.5])
[2020-03-17 09:55:34] DEBUG [JAejdt6KMrw] Resolved smtp.office365.com as 40.100.54.194 [cache miss]
[2020-03-17 09:55:35] INFO  [JAejdt6KMrw] Connection established to 40.100.54.194:587
[2020-03-17 09:55:35] INFO  [JAejdt6KMrw] Connection upgraded with STARTTLS
[2020-03-17 09:55:36] DEBUG [JAejdt6KMrw] SMTP handshake …
Run Code Online (Sandbox Code Playgroud)

javascript email smtp node.js nodemailer

3
推荐指数
1
解决办法
4691
查看次数

标签 统计

email ×1

javascript ×1

node.js ×1

nodemailer ×1

smtp ×1