带有Gmail“发件人:地址”的Nodemailer不会更改

我正尝试将电子邮件发送给我的邮件列表中的任何新订阅者。 一切都很好,但“发件人”的电子邮件地址不会改变为“noreplay”,它仍然是我authentication的电子邮件,在这种情况下,我的工作邮件。例如,如果我将“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); }); 

我只是build立在文档的例子上。 收到的电子邮件来自“JaafarsCompany”,但如果您点击发件人名称,它会显示我的工作邮件。

希望是有道理的。 我正在寻找能够指引我正确方向的事情。 我觉得我一直在谷歌search这个问题的年龄:(

我找出了问题所在。 基本上文档说:

Gmail也始终将authentication用户名设置为发件人:电子邮件地址。 因此,如果您通过foo@example.com进行身份validation,并将bar@example.com设置为from:地址,那么Gmail将恢复此操作,并将该发件人replace为已通过身份validation的用户。

要解决此问题,需要在pipe理控制台中添加一个组。 之后,去这个链接,并按照说明。

我曾经从Firebase支持人员的帮助下解决了这个问题。 希望这有助于某一天:-)