我正在尝试向多个收件人发送电子邮件.为此,我创建了一个收件人数组,但是使用我的代码,我只能将邮件发送到阵列的最后一次电子邮件ID三次.我的代码出了什么问题?
var nodemailer = require("nodemailer");
var smtpTransport = nodemailer.createTransport(
"SMTP",{
host: '',
// secureConnection: true, // use SSL
port: 25
});
var maillist = [
'****.sharma3@****.com',
'****.bussa@****.com',
'****.gawri@****.com',
];
var msg = {
from: "******", // sender address
subject: "Hello ?", // Subject line
text: "Hello This is an auto generated Email for testing from node please ignore it ?", // plaintext body
cc: "*******"
// html: "<b>Hello world ?</b>" // html body
}
maillist.forEach(function (to, i , array) { …Run Code Online (Sandbox Code Playgroud)