[英]Vue.js sending email with SendGrid v3 : not allowed access
我正在嘗試使用 SendGrid v3 發送電子郵件...在開發模式下,當我從本地主機發送消息並且我的 SendGrid 帳戶已為我的生產域 www.mydomain.com 設置時,我收到一條錯誤消息:未授權..我能夠了解...
Failed to load https://api.sendgrid.com/v3/mail/send: Response to preflight
request doesn't pass access control check: The 'Access-Control-Allow-Origin' header
has a value '://sendgrid.api-docs.io' that is not equal to the supplied origin.
Origin '://localhost:8080' is therefore not allowed access. Have the server send
the header with a valid value, or, if an opaque response serves your needs,
set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
有沒有辦法在開發模式下使用 SendGrid? 還是我應該繞過發送郵件?
if (process.env.NODE_ENV === 'production) {
this.sendContactEmail()
} else {
console.log('CANNOT SEND MESSAGE IN DEVELOPMENT ENVIRONMENT')
}
感謝您的反饋
您不能在基於客戶端的應用程序中使用 SendGrid。 這可能是它失敗的原因。 您需要一個后端服務器/服務,或者如您所說,您可以使用 firebase 的無服務器功能來觸發 API 調用
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.