Gmail "From: address" 的 Nodemailer 没有变化
Nodemailer with Gmail "From: address" does not change
我正在尝试向我的邮寄列表中的任何新订阅者发送电子邮件。一切正常,但 "sender" 电子邮件地址没有更改为 "noreplay. It stays as the email I authenticated with, in this case my work mail. For example, if I set the " 从“到 "noreply@example.com" 它从 "jaafar@example.com" 发送邮件。这是我的代码:
if (snapshot.child("subscribed").val() === 'true') {
var value = snapshot.child("email").val(); //ignore this
var key = snapshot.key; //ignore this
var mailHtml = val.htmlText1 + httpLink + key + val.htmlText2; //ignore this
let mailOptions = {
from: '"JaafarsCompany" <noreply@jaafarsCompany.io>', // sender address
to: value, // list of receivers
subject: 'Hello', // Subject line
text: 'Hello world', // plain text body
html: mailHtml //ignore this
};
// send mail with defined transport object
mailTransport.sendMail(mailOptions, (error, info) => {
if (error) {
return console.log(error);
}
console.log('Mail sent to: ' + value + '. ' + 'Message %s sent: %s', info.messageId, info.response);
});
我只是基于文档中的示例构建的。收到的电子邮件好像来自 "JaafarsCompany",但如果您单击发件人姓名,它会显示我的工作邮件。
希望这是有道理的。我正在寻找任何可以指向正确方向的东西。我觉得我已经用谷歌搜索这个问题很久了:(
我明白问题出在哪里了。基本上文档说:
Gmail also always sets authenticated username as the From: email
address. So if you authenticate as foo@example.com and set
bar@example.com as the from: address, then Gmail reverts this and
replaces the sender with the authenticated user.
要解决此问题,需要在管理控制台中添加一个组。之后转到 this link,然后按照说明进行操作。
我在 Firebase 支持者的帮助下解决了这个问题。希望有一天这对某人有所帮助:-)
我正在尝试向我的邮寄列表中的任何新订阅者发送电子邮件。一切正常,但 "sender" 电子邮件地址没有更改为 "noreplay. It stays as the email I authenticated with, in this case my work mail. For example, if I set the " 从“到 "noreply@example.com" 它从 "jaafar@example.com" 发送邮件。这是我的代码:
if (snapshot.child("subscribed").val() === 'true') {
var value = snapshot.child("email").val(); //ignore this
var key = snapshot.key; //ignore this
var mailHtml = val.htmlText1 + httpLink + key + val.htmlText2; //ignore this
let mailOptions = {
from: '"JaafarsCompany" <noreply@jaafarsCompany.io>', // sender address
to: value, // list of receivers
subject: 'Hello', // Subject line
text: 'Hello world', // plain text body
html: mailHtml //ignore this
};
// send mail with defined transport object
mailTransport.sendMail(mailOptions, (error, info) => {
if (error) {
return console.log(error);
}
console.log('Mail sent to: ' + value + '. ' + 'Message %s sent: %s', info.messageId, info.response);
});
我只是基于文档中的示例构建的。收到的电子邮件好像来自 "JaafarsCompany",但如果您单击发件人姓名,它会显示我的工作邮件。
希望这是有道理的。我正在寻找任何可以指向正确方向的东西。我觉得我已经用谷歌搜索这个问题很久了:(
我明白问题出在哪里了。基本上文档说:
Gmail also always sets authenticated username as the From: email address. So if you authenticate as foo@example.com and set bar@example.com as the from: address, then Gmail reverts this and replaces the sender with the authenticated user.
要解决此问题,需要在管理控制台中添加一个组。之后转到 this link,然后按照说明进行操作。
我在 Firebase 支持者的帮助下解决了这个问题。希望有一天这对某人有所帮助:-)