Using Mailgun RestFUL's on client-side

旧城冷巷雨未停 提交于 2019-12-09 07:03:30

问题


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?


回答1:


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?



来源:https://stackoverflow.com/questions/18370245/using-mailgun-restfuls-on-client-side

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!