Eric K.
Eric K.

Reputation: 131

Possible to send an email from SendGrid & React.js without a back-end?

I have a React.js app that I am hosting on a cPanel that does not allow a back-end within the application. Wondering if I can get sendgrid to work without the back-end? Has anyone gotten this to work previously?

I currently get the following error:

Access to fetch at 'https://api.sendgrid.com/v3/mail/send' from origin ' 
    https://angelospizzaharvard.com' has been blocked by CORS policy: Response 
    to preflight request doesn't pass access control check: The 'Access-Control- 
    Allow-Origin' header has a value 'https://sendgrid.api-docs.io' that is not 
    equal to the supplied origin. 


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.
    Navbar.js:427 TypeError: Failed to fetch

Upvotes: 3

Views: 2057

Answers (1)

Shmili Breuer
Shmili Breuer

Reputation: 4147

From this link sendgrid docs, it seems that it could only be called from a back-end server.

Upvotes: 2

Related Questions