Vue.js使用SendGrid v3发送电子邮件:不允许访问

时间:2018-05-03 17:46:05

标签: vue.js sendgrid-api-v3

我正在尝试发送电子邮件给SendGrid v3 ... 在开发模式下,因为我从localhost发送消息并且我的生成域www.mydomain.com设置了我的SendGrid帐户,我收到一条错误消息:非授权..我能理解......

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')
    }

感谢您的反馈

0 个答案:

没有答案