简体   繁体   English

在客户端使用Mailgun RestFUL

[英]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. 我一直在研究Mailgun( http://documentation.mailgun.com/api-sending.html ),但我很困惑我可以放入我的API密钥。 I am attempting to make a POST request with jQuery, could someone point me to an example of sending an email? 我试图用jQuery发出POST请求,有人能指点我发送电子邮件的例子吗?

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: 根据Mailgun的API Intro的Authentication部分 ,它们需要Basic Auth,它通过添加以下HTTP头代码完成:

Authorization: Basic base64($username:$password)

For Mailgun, they mention using api as the username and your API key as the password. 对于Mailgun,他们提到使用api作为用户名,使用API​​密钥作为密码。

For more details on how to add the Basic Auth header via jQuery, see this: How to use Basic Auth with jQuery and AJAX? 有关如何通过jQuery添加Basic Auth标头的更多详细信息,请参阅: 如何在jQuery和AJAX中使用Basic Auth?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM