首页 > 解决方案 > SendGrid 总是将我的电子邮件发送到收件人的垃圾邮件文件夹

问题描述

我正在尝试使用 SendGrid 的Node.js 邮件客户端从我的Firebase Cloud Functions发送电子邮件

我按照他们的例子描述如下:

const sgMail = require('@sendgrid/mail');
sgMail.setApiKey(functions.config().sendgrid.key);
const msg = {
  to: 'my_own_mail@gmail.com',
  from: 'my_other_own_mail@gmail.com',
  subject: 'Sending with Twilio SendGrid is Fun',
  text: 'and easy to do anywhere, even with Node.js',
  html: '<strong>and easy to do anywhere, even with Node.js</strong>',
};
sgMail.send(msg);

一旦函数被触发,一切都会成功执行。在我的函数日志中,我得到了状态 202,实际邮件被传递,但不是在主邮箱中,而是在垃圾邮件文件夹中。当我打开消息时,它只是说:

在此处输入图像描述

我真的不明白是什么问题。

注意:如果我将邮件发送到 Yahoo 电子邮件,它不会进入垃圾邮件文件夹。如果我将其发送到我的企业电子邮件,同样适用。

标签: emailgoogle-cloud-functionssendgrid

解决方案


您的问题与云功能或代码无关,您需要遵循一些反垃圾邮件规则,这给了我一个很好的起点


推荐阅读