【发布时间】:2017-07-31 00:34:17
【问题描述】:
var nodemailer = require('nodemailer');
// Not the movie transporter!
var transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user: '*****@gmail.com', // Your email id
pass: '*******' // Your password
}
});
var mailOptions = {
from: varfrom_name, // sender address
to: varto, // list of receivers
subject: varsubject, // Subject line
text: vartext, // plaintext body
html: varhtml // html body
};
console.log(mailOptions);
// send mail with defined transport object
transporter.sendMail(mailOptions, function (error, info) {
if (error) {
return console.log(error);
}else{
return console.log(info);
}
});
我想要与经过身份验证的发件人地址不同的发件人地址? 假设我使用 abc@gmail.com 验证了数据,但我想将邮件从 xyz@gmail.com 发送到 def@gmail.com。 如何在 node-mailer 中做到这一点?
// Using send mail npm module
var sendmail = require('sendmail')({silent: true})
sendmail({
from: ' xyz@gmail.com',
to: 'def@gmail.comh',
subject: 'MailComposer sendmail',
html: 'Mail of test sendmail ',
attachments: [
]
}, function (err, reply) {
console.log(err && err.stack)
console.dir(reply)
})
但是span box中的邮件和我们发送的邮件不会显示在发件人邮件地址的已发送邮件中?
我希望我能详细说明我的问题
【问题讨论】:
标签: javascript node.js email sendmail nodemailer