无法使用Nodemailer连接到Outlook.com SMTP [英] Not able to connect to outlook.com SMTP using Nodemailer
问题描述
我正在创建像这样的运输对象.
I am creating the transport object like this.
var transport = nodemailer.createTransport("SMTP", {
host: "smtp-mail.outlook.com", // hostname
secureConnection: false, // use SSL
port: 587, // port for secure SMTP
auth: {
user: "user@outlook.com",
pass: "password"
}
});
这是我尝试发送邮件时遇到的错误.
This is the error which I am getting, when I try to send the mail.
[错误:139668100495168:错误:1408F10B:SSL 例程:SSL3_GET_RECORD:版本错误 编号:../deps/openssl/openssl/ssl/s3_pkt.c:337:]
[Error: 139668100495168:error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number:../deps/openssl/openssl/ssl/s3_pkt.c:337: ]
当我尝试将ignoreTLS设置为true时.这就是我得到的
When I tried setting ignoreTLS as true. This is what I am getting
{[AuthError:无效的登录-530 5.7.0必须发出STARTTLS命令 first]名称:'AuthError',数据:'530 5.7.0必须发出STARTTLS 首先命令"}
{ [AuthError: Invalid login - 530 5.7.0 Must issue a STARTTLS command first] name: 'AuthError', data: '530 5.7.0 Must issue a STARTTLS command first' }
我做错什么了吗?请帮忙.
Am I doing something wrong? Please help.
推荐答案
我遇到了同样的问题,直到偶然发现 https://github.com/andris9/Nodemailer/issues/165
I was having the same issue until I stumbled upon https://github.com/andris9/Nodemailer/issues/165
尝试添加tls cipher选项以使用SSLv3.
Try adding the tls cipher option to use SSLv3.
var transport = nodemailer.createTransport("SMTP", {
host: "smtp-mail.outlook.com", // hostname
secureConnection: false, // TLS requires secureConnection to be false
port: 587, // port for secure SMTP
auth: {
user: "user@outlook.com",
pass: "password"
},
tls: {
ciphers:'SSLv3'
}
});
或者,对于hotmail/live/outlook,您可以简单地使用
Alternatively, for hotmail/live/outlook you can simply use
var transport = nodemailer.createTransport("SMTP", {
service: "hotmail",
auth: {
user: "user@outlook.com",
pass: "password"
}
});
这篇关于无法使用Nodemailer连接到Outlook.com SMTP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!