我正在尝试使用 nodemailer 通过我在JustHost中拥有的邮件服务器发送电子邮件。我正在使用托管提供的SMTP设置。
let transporter = nodemailer.createTransport({
host: 'mail.wegocuba.com',
port: 465,
secure: true,
auth: {
user: PROVIDERS.wegocuba.user,
pass: PROVIDERS.wegocuba.pass
},
tls: {
rejectUnauthorized: false
}
});
let configureMailer = (text, to) => {
return {
from: '"USER" <user@wegocuba.com>',
to: to, // list of receivers
subject: 'Hello world',
text: text,
};
};
mySendMail = (to, text) => {
let sender = configureMailer(text, to);
transporter.sendMail(sender, (error, info) => {
if (error) {
return console.log(error);
}
console.log(info.messageId);
});
},
当我调用 mySendMail(to,text)函数时,服务器会毫无问题地响应。
{ accepted: [ 'myemail@gmail.com' ],
rejected: [],
envelopeTime: 107,
messageTime: 73,
messageSize: 288,
response: '250 OK id=1eUGz4-003LtQ-RK',
envelope: { from: 'user@wegocuba.com', to: [ 'myemail@gmail.com' ] },
messageId: '<9efa8726-6d8b-2161-36d5-023b49799871@wegocuba.com>' }
但是电子邮件永远不会到达收件人,也不会显示为在SENT文件夹中发送。 我怎么知道邮件服务器到底发生了什么?