Jaa*_*hdi 3 node.js firebase nodemailer google-cloud-functions
我正在尝试向我的邮件列表中的任何新订阅者发送电子邮件。一切正常,但“发件人”电子邮件地址不会更改为“noreplay”。它仍然是我进行身份验证的电子邮件,在本例中是我的工作邮件。例如,如果我将“from”设置为“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);
});
Run Code Online (Sandbox Code Playgroud)
我仅基于文档中的示例进行构建。收到的电子邮件看起来像是来自“JaafarsCompany”,但如果您单击发件人姓名,它会显示我的工作邮件。
希望这是有道理的。我正在寻找任何可以为我指明正确方向的东西。我觉得我已经在谷歌上搜索这个问题很多年了:(
| 归档时间: |
|
| 查看次数: |
5917 次 |
| 最近记录: |