使用 Nodemailer 和 NodeJS 时出现错误。我尝试使用我的网站发送电子邮件,但遇到问题,电子邮件已发送,但我的 Gmail 界面上的“发件人”和“收件人”有相同的电子邮件...
截图:http ://glui.me/?i=g43rrwpgdy6voy5/2014-03-18_at_18.32_2x.png/
我的代码:
var contact = req.body.contact;
var compagny = contact.compagny;
var email = contact.email;
var object = contact.object;
var message = contact.message;
var to = 'myemail@gmail.com';
var transport = nodemailer.createTransport("SMTP",{
service: "Gmail",
auth: {
user: "myemail@gmail.com",
pass: "*********"
}
});
var options = {
from: email,
to: to,
subject: object,
text: "Société : "+compagny+"\nEmail : "+email+"\nMessage : "+message
}
transport.sendMail(options, function(error, response) {
if (error)
console.log(error);
else
res.redirect('/');
});