我无法使用 SMTP 接口触发邮件,我只更改了示例代码。我什至仔细检查了密码。它是正确的。
var nodemailer = require('nodemailer');
// create reusable transporter object using SMTP transport.
var transporter = nodemailer.createTransport({
"host": "smtpdm.aliyun.com",
"port": 25,
"secureConnection": false, // use SSL
"auth": {
"user": 'admin@mail.actestdomain.xyz', // user name
"pass": '**CorrectPassword**'
}
});
var mailOptions = {
from: 'NickName<username@userdomain>', // sender address mailfrom must be same with the user.
to: 'Admin@acclouddemo', // list of receivers
cc:'', // copy for receivers
bcc:'', // secret copy for receivers
subject: 'Hello', // Subject line
text: 'Hello world', // plaintext body
html: '<b>Hello world</b><img class="img-responsive"src="cid:01" style="width:200px;height:auto">'
};
// send mail with defined transport object
transporter.sendMail(mailOptions, function(error, info){
if(error){
return console.log(error);
}
console.log('Message sent: ' + info.response);
});
我在这里想念什么?