Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Mailgun RestFUL's on client-side

I am attempting to build an anonymous customer feedback form which forwards the content to an email address. I've been looking into Mailgun (http://documentation.mailgun.com/api-sending.html), but I am confused where I could put in my API key. I am attempting to make a POST request with jQuery, could someone point me to an example of sending an email?

like image 655
zhuyxn Avatar asked Mar 03 '26 22:03

zhuyxn


1 Answers

According to the Authentication section of Mailgun's API Intro, they require Basic Auth, which is accomplished in code by adding the following HTTP header:

Authorization: Basic base64($username:$password)

For Mailgun, they mention using api as the username and your API key as the password.

For more details on how to add the Basic Auth header via jQuery, see this: How to use Basic Auth with jQuery and AJAX?

like image 188
superEb Avatar answered Mar 05 '26 13:03

superEb



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!