Am using sendGrid (https://api.sendgrid.com/v3/mail/send) to send mail from frontEnd.
but getting the CORS error. To fix this issue I tried to add following code in headers, but not get fixed:
‘Access-Control-Allow-Origin’: ‘https://sendgrid.com’,
‘Access-Control-Allow-Methods’: ‘POST, GET, OPTIONS’,
‘Access-Control-Allow-Headers’:‘X-Requested-With’,
“Accept-Encoding”:“gzip, deflate, br”,
“Accept”: “/”,
So I need help here to fix this cors issue , so that I can use sendgrid API to send mail from front-end.
SendGrid does not allow you to use their endpoints directly from a frontend application.
You need to create a backend service which does the actual request to SendGrid.
You need to implement your own (small) microservice that integrates the sendGrid API. I’m not aware of an existing microservice just doing that…
As an alternative you can use webMethods.io to integrate sendGrid and trigger sending email via Events or directly.