https://sendgrid.com/docs/ui/sending-email/sender-verification
希望这有所帮助。ResponseError: Forbidden
at node_modules/@sendgrid/client/src/classes/client.js:133:29
at processTicksAndRejections (internal/process/task_queues.js:93:5) {
code: 403,
response: {
headers: {
server: 'nginx',
date: 'Sat, 10 Oct 2020 17:22:02 GMT',
'content-type': 'application/json',
'content-length': '281',
connection: 'close',
'access-control-allow-origin': 'https://sendgrid.api-docs.io',
'access-control-allow-methods': 'POST',
'access-control-allow-headers': 'Authorization, Content-Type, On-behalf-of, x-sg-elas-acl',
'access-control-max-age': '600',
'x-no-cors-reason': 'https://sendgrid.com/docs/Classroom/Basics/API/cors.html'
},
这里的意思是,from:地址
。
const msg = {
to: 'recepient@email.com',
from: 'sender@email.com', //this is the address that needs to be verified by sendgrid
subject: 'Sending from Sendgrid',
text: 'here is the test from node',
html: `<strong> Here is the order #${orderNumber} user: ${user} </strong>`,
}
在验证发件地址时,请检查是否使用了from
电子邮件地址。
webapp.com
那么,如果电子邮件from
键与已验证的域from:*@webapp.com
匹配,则您将能够成功使用您的SendGrid API KEY发送电子邮件
2 单个发件人验证
这是另一种选项,您可以验证一个单独的电子邮件地址,例如person@email.com
.
然后,您将能够通过您的SendGrid API KEY发送电子邮件from: person@email.com
。From
字段应与您验证为“单发件人”的电子邮件地址匹配以使其正常工作。验证您的单发件人帐户,其中发送者身份验证/单发件人验证/操作列(三点)(发送验证电子邮件-编辑-删除菜单)
from: 'emailAddress@email.com'
还没有被Sendgrid确认/验证。 - Jonathan Sanchez