【问题标题】:Gmail does not respect email alias when sending emails with nodemailer使用 nodemailer 发送电子邮件时,Gmail 不尊重电子邮件别名
【发布时间】:2021-04-26 02:14:10
【问题描述】:

我有一个 Google Workspace 帐户 foo@domain.com。我设置了邮箱别名noreply@domain.com,以及应用密码。

我想以noreply@domain.com 发送电子邮件。但是,当我执行以下操作时:

  let mailer = nodemailer.createTransport({
    service: 'gmail',
    auth: {
      user: 'foo@domain.com',
      pass: '<password>',
    },
  });

  const resp = await mailer.sendMail({
    from: 'No Reply <noreply@domain.com>',
    to: 'some@email.com',
    subject: 'Test2'});
  console.log(resp);

邮件发送成功,收到有效回复:

{
  accepted: [ 'some@email.com' ],
  rejected: [],
  envelopeTime: 257,
  messageTime: 390,
  messageSize: 248,
  response: '250 2.0.0 OK  ... - gsmtp',
  envelope: {
    from: 'noreply@domain.com',
    to: [ 'some@email.com' ]
  },
  messageId: '<...@domain.com>'
}

但是,收到的电子邮件仍然显示发件人为No Reply &lt;foo@domain.com&gt;

我不想创建另一个完整用户 noreply@domain.com(这在 Google Workspace 上需要额外付费):有没有办法让 Gmail 使用电子邮件别名作为发件人?

【问题讨论】:

    标签: nodemailer


    【解决方案1】:

    好的,所以我在发布问题 2 分钟后才真正想到这一点。

    对于后代,除了在管理控制台 (admin.google.com) 中为帐户添加别名外,您还必须进入该帐户的 Gmail 设置并手动启用别名(请参阅https://support.google.com/mail/answer/22370?hl=en)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-07-18
      • 1970-01-01
      • 1970-01-01
      • 2022-07-27
      • 2015-05-19
      相关资源
      最近更新 更多