如何解决发件人地址与经过验证的发件人身份不匹配
作为所有者,我已经在 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 邮件中声明为发件人地址的任何电子邮件帐户都必须经过验证。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。