zhuyxn
zhuyxn

Reputation: 7091

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?

Upvotes: 3

Views: 5663

Answers (1)

superEb
superEb

Reputation: 5673

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?

Upvotes: 2

Related Questions