当用户注册时,我正在处理发送的电子邮件。我正在免费使用新的 SendGrid 帐户,但是当我运行我的函数时,它会向我显示以下错误,谁能告诉我我将如何解决它。下面是我的 Golang 函数func SendOtpMail(OTP string) (err error) { from := mail.NewEmail("Test", "test@example.com") subject := "Comfirmation Mail" to := mail.NewEmail("puneet", "puneet123@gmail.com") // plainTextContent := "" htmlContent := "Your confirmation OTP is = " + OTP message := mail.NewSingleEmail(from, subject, to, " ", htmlContent) // ("" = plainTextContent) client := sendgrid.NewSendClient("Api_key") response, err := client.Send(message) fmt.Println(response) fmt.Println(err) return err}作为回应,它将返回控制台下方的输出:&{403 {"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}]} map[Access-Control-Allow-Headers:[Authorization, Content-Type, On-behalf-of, x-sg-elas-acl] Access-Control-Allow-Methods:[POST] Access-Control-Allow-Origin:[https://sendgrid.api-docs.io] Access-Control-Max-Age:[600] Connection:[keep-alive] Content-Length:[281] Content-Type:[application/json] Date:[Sat, 25 Apr 2020 12:56:25 GMT] Server:[nginx] X-No-Cors-Reason:[https://sendgrid.com/docs/Classroom/Basics/API/cors.html]]}我也在 2019 年实现了同样的功能,然后它正在工作,但现在我想更改它,然后这向我显示了这个错误。这个你能帮我吗。
3 回答
慕森王
TA贡献1777条经验 获得超3个赞
由于这是 sendgrid 为保护您的发送声誉和维护合法发送行为而创建的新设置,因此他们要求客户验证其发件人身份。由于这些旧的 sendgrid 帐户不会受到影响,因此 2020 年 4 月 6 日之后创建的帐户将能够进行发件人验证。
检查此文档以获取信息 - https://sendgrid.com/docs/ui/sending-email/sender-verification
湖上湖
TA贡献2003条经验 获得超2个赞
根据 sendgrid 提供的文档。在发送任何电子邮件之前,您应该对发件人进行身份验证,
有两种方法可以做到
域认证
单一发件人身份验证
请按照以下链接进行单发件人身份验证
https://sendgrid.com/docs/ui/sending-email/sender-verification
扬帆大鱼
TA贡献1799条经验 获得超9个赞
验证您的电子邮件
重启你的服务器
如果仍然存在错误,则输入 DEFAULT_FROM_EMAIL = yourverifiedgmail@gmail.com EMAIL_FROM=yourverifiedgmail@gmail.com
重新启动服务器,错误应该消失了
- 3 回答
- 0 关注
- 220 浏览
添加回答
举报
0/150
提交
取消