當用戶注冊時,我正在處理發送的電子郵件。我正在免費使用新的 SendGrid 帳戶,但是當我運行我的函數時,它會向我顯示以下錯誤,誰能告訴我我將如何解決它。下面是我的 Golang 函數func SendOtpMail(OTP string) (err error) { from := mail.NewEmail("Test", "[email protected]") subject := "Comfirmation Mail" to := mail.NewEmail("puneet", "[email protected]") // 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 = [email protected] [email protected]
重新啟動服務器,錯誤應該消失了
- 3 回答
- 0 關注
- 272 瀏覽
添加回答
舉報
0/150
提交
取消