嘿,当我尝试向发件人的电子邮件地址发送电子邮件时出现错误。我正在使用节点邮件程序,并且已经共享了托管电子邮件帐户,当我尝试从该电子邮件帐户发送电子邮件时,出现如下错误:
Error occurred. Client network socket disconnected before secure TLS connection was established
这是我编写的节点邮件程序代码
let transporter = nodemailer.createTransport({
host:'mail.abcdefgh.com',
port:465,
secure:true,
// debug: true,
// logger: true,
auth: {
user: 'abcd@efgh.com',
pass: '12345'
},
tls: {
rejectUnauthorized: false
}
});
console.log(user);
// Message object
let message = {
from: '"Sachin" <abcd@efgh.com>',
to: user.email,
subject: 'You successfully registered for for the event',
text: `Welcome ${user.name.toUpperCase()} toour community`,
html:'<h2>Hello</h2>'
};
transporter.sendMail(message, (err, info) => {
if (err) {
console.log('Error occurred. ' + err.message);
return process.exit(1);
}
console.log('Credentials obtained, sending message...');
console.log('Message sent: %s', info.messageId);
// Preview only available when sending through an Ethereal account
// console.log('Preview URL: %s', nodemailer.getTestMessageUrl(info));
});
请帮助我