您好,我正在尝试通过节点邮件程序通过多个收件人发送邮件,但它仅发送给最后三个收件人,有时会多次发送给同一收件人。这是我的代码,在此先感谢您的帮助。
maillist.push('abdv@xyz.com');
maillist.push('abdv@xyz.com');
maillist.push('abdv@xyz.com');
maillist.push('abdv@xyz.com');
maillist.push('abdv@xyz.com');
maillist.push('abdv@xyz.com');
maillist.push('abdv@xyz.com');
maillist.push('abdv@xyz.com');
var options = { viewEngine:{ 扩展名:“。hbs”, layoutsDir:'template /', defaultLayout:“ mailtemplate”, partialsDir:“模板/” }, viewPath:'模板/', extName:“。hbs” }; 让transporter = nodeMailer.createTransport({ 主持人:“ Apacsmtp.xyz.com”, 端口:25, secureConnection:false
});
transporter.use('compile', hbs(options));
let mailOptions =
{
from: 'abc@xyz.com.com',
subject: 'update alert', // Subject line
template: 'mailtemplate',
to:[],
context: {
case_client: client,
case_activity: activity,
case_name: casestudy_name,
case_id: casestudy_id,
case_url: "https://xyz@xyz.com/detail" + casestudy_id
}
};
transporter.sendMail(mailOptions, (error, info) => {
console.log("inside sendMail");
if (error) {
return console.log(error);
return res.json({ "status": "550", "message": "something went wrong" });
}
else {
return res.json({ "status": "200", "message": "email send successfully" });
console.log('Message %s sent: %s', info.messageId, info.response);
}
//res.render('index');
});