发件人地址与已验证的发件人标识不匹配



作为所有者,我已经在sendgrid中验证了我的gmail,当我用所有者邮件帐户发送消息时,它已经发送了,但当我试图用不同的邮件帐户作为客户发送邮件时,会显示这样的错误:这意味着客户还需要用sendGrid验证他们的邮件帐户?

{
errors: [
{
message: 'The from address does not match a verified Sender Identity. Mail cannot be sent until this error is resolved. Visit https://sendgrid.com/docs/for-developers/sending-email/sender-identity/ to see the Sender Identity requirements',
field: 'from',
help: null
}
]
}

我不知道为什么。

我尝试过以下代码:

const sgMail = require("@sendgrid/mail");
sgMail.setApiKey(process.env.SENDGRID_API_KEY);
exports.contactForm = (req, res) => {
const { email, name, message } = req.body;
const emailData = {
to: process.env.EMAIL_TO,
from: email,
subject: `Contact form - ${process.env.APP_NAME}`,
text: `Email received from contact from n Sender name: ${name} n Sender email: ${email} n Sender message: ${message}`,
html: `
<h4>Email received from contact form:</h4>
<p>Sender name: ${name}</p>
<p>Sender email: ${email}</p>
<p>Sender message: ${message}</p>
<hr />
<p>This email may contain sensetive information</p>

`,
};
sgMail
.send(emailData)
.then(() => {
console.log("Message sent");
})
.catch((error) => {
console.log(error.response.body);
});
};

有什么建议吗。

Sendgrid(以及其他批量电子邮件供应商(要求您发送来自以下地址的每封电子邮件。您可能不会通过Sendgrid发送邮件,因此在收件人看来,邮件来自任意未经验证的电子邮件帐户。

为什么不呢?垃圾邮件

像Sendgrid这样的公司会遇到很多麻烦来阻止他们的客户使用他们的服务发送垃圾邮件。如果他们让客户发送垃圾邮件,他们的服务器将被gmail、outlook和其他大型电子邮件提供商屏蔽,并出现在小型电子邮件提供商使用的反垃圾邮件屏蔽列表中。如果发生这种情况,他们的生意很快就会破产。

因此,您在Sendgrid消息中声称为发件人地址的任何电子邮件帐户都必须经过验证。

不幸的是,您确实无法通过SendGrid从未经验证的电子邮件发送电子邮件。要做到这一点,你需要使用另一个电子邮件服务,例如,我使用SendInBlue来完成这一操作(更新:SendInBlue改了名称,现在它们是Brevo(

最新更新