# Help needed with 'wix-fetch' to send email using SendGrid

**URL:** <https://forum.wixstudio.com/t/help-needed-with-wix-fetch-to-send-email-using-sendgrid/28386>\
**Category:** Ask the community\
**Tags:** question, code\
**Created:** [October 23, 2017, 2:00pm UTC](https://forum.wixstudio.com/t/help-needed-with-wix-fetch-to-send-email-using-sendgrid/28386 "2017-10-23T14:00:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![alex-shea](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/alex-shea/32/967_2.png) [@alex-shea](https://forum.wixstudio.com/u/alex-shea)\
**Post date:** [October 23, 2017, 2:00pm UTC](https://forum.wixstudio.com/t/help-needed-with-wix-fetch-to-send-email-using-sendgrid/28386/1 "2017-10-23T14:00:44Z")

</div>

Hello Everybody,

I would like wix-fetch to send email from wix code via a third party API provided by SendGrid.

My codes are as follows:

fetch(“[https://api.sendgrid.com/v3/mail/send](https://api.sendgrid.com/v3/mail/send)”,  
{method: ‘POST’,  
headers: {‘Authorization’: ‘Bearer SG.rZ96miEdQXKohaalqOS65g.BQ\_TaC83Fs1TnqFTvFDmiPmaBq9mPJRAPUBvir\_Xg’, ‘Content-Type’: ‘application/json’},   
body: JSON.stringify(  
{  
“personalizations”: [  
{  
“to”: [  
{  
“email”: “[xxx@gmail.com](mailto:xxx@gmail.com)”  
}  
],  
“subject”: “Hello, World!”  
}  
],  
“from”: {  
“email”: “[from\_address@example.com](mailto:from_address@example.com)”  
},  
“content”: [  
{  
“type”: “text/html”,  
“value”: “

# Hello, World!
”  
}  
]  
})   
})  
.then(response =\> response.json())  
.catch(error =\> console.log(‘error:’, error));

However, I keep on get the error message ‘TypeError: Failed To Fetch’.  
I have tried to call the API using hurl.it and managed to call the web service successfully using the parameters used in the codes above.

I would really appreciate if anyone can give me pointers where did I go wrong.

Thank you.

---

<div class="post-metadata">

**Author:** ![sam-wix](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/sam-wix/32/683_2.png) [@sam-wix](https://forum.wixstudio.com/u/sam-wix)\
**Post date:** [October 23, 2017, 2:12pm UTC](https://forum.wixstudio.com/t/help-needed-with-wix-fetch-to-send-email-using-sendgrid/28386/2 "2017-10-23T14:12:33Z")

</div>

Hey Alex,

Have you tried looking at this article: [Velo Tutorial: Sending an Email on Form Submission | Help Center | Wix.com](https://support.wix.com/en/article/how-to-send-an-email-on-form-submission)?

---

<div class="post-metadata">

**Author:** ![threedesign2014](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/threedesign2014/32/884_2.png) [@threedesign2014](https://forum.wixstudio.com/u/threedesign2014)\
**Post date:** [October 23, 2017, 2:31pm UTC](https://forum.wixstudio.com/t/help-needed-with-wix-fetch-to-send-email-using-sendgrid/28386/3 "2017-10-23T14:31:56Z")

</div>

The article is fine but after following the tutorial i am still not able to send row updates or field submissions from user input elements that are attached to my database. I would pay for a module in the database module that i could connect to a selection of mail providers to transmit my form data. currently i use 123contact form but i cannot customise it enough to interact with individual pages on the website that are posting data to the same database.

---

<div class="post-metadata">

**Author:** ![sam-wix](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/sam-wix/32/683_2.png) [@sam-wix](https://forum.wixstudio.com/u/sam-wix)\
**Post date:** [October 24, 2017, 6:16am UTC](https://forum.wixstudio.com/t/help-needed-with-wix-fetch-to-send-email-using-sendgrid/28386/4 "2017-10-24T06:16:17Z")

</div>

Hi Russell,

I’m not sure what you mean by:

> send row updates or field submissions from user input elements that are attached to my database  
> Could please elaborate?

---

<div class="post-metadata">

**Author:** ![threedesign2014](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/threedesign2014/32/884_2.png) [@threedesign2014](https://forum.wixstudio.com/u/threedesign2014)\
**Post date:** [November 1, 2017, 2:58pm UTC](https://forum.wixstudio.com/t/help-needed-with-wix-fetch-to-send-email-using-sendgrid/28386/5 "2017-11-01T14:58:16Z")

</div>

i am creating a quote request form where users click on objects and type info which is registered in my database. i want to send the info every time that a submission is made to the sales email. using the tutorial that was given i cannot seem to find where to put the send grid email in order for it to work with the api and send the message.

---

<div class="post-metadata">

**Author:** ![webmaster-1](https://avatars.discourse-cdn.com/v4/letter/w/58956e/32.png) [@webmaster-1](https://forum.wixstudio.com/u/webmaster-1)\
**Post date:** [January 27, 2018, 10:23pm UTC](https://forum.wixstudio.com/t/help-needed-with-wix-fetch-to-send-email-using-sendgrid/28386/6 "2018-01-27T22:23:24Z")

</div>

I’m trying to do the same thing, did you ever find a solution to this problem?
