使用Javascript发送带有Mailgun的电子邮件

前端之家收集整理的这篇文章主要介绍了使用Javascript发送带有Mailgun的电子邮件前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在使用JS,我有以下代码
var XHRResponse = XHR.send("POST","https://api.mailgun.net/v2/sandBox224f28ae45a8499d84184fd4c48e62ee.mailgun.org/messages",{
    "parameters": {
      "from": "Mailgun SandBox <postmaster@sandBox224f28ae45a8499d84184fd4c48e62ee.mailgun.org>","to": "Jordi <myname@gmail.com>","subject": "Hello Jordi","text": "Congratulations Jordi,you just sent an email with Mailgun!  You are truly awesome!  You can see a record of this email in your logs: https://mailgun.com/cp/log .  You can send up to 300 emails/day from this sandBox server.  Next,you should add your own domain so you can send 10,000 emails/month for free."
    }
  });

我需要使用apikey进行身份验证,但我不知道在哪里以及如何进行身份验证.

谢谢

解决方法

Mailgun API文档包含所有这些信息.具体来说,请查看“身份验证”部分,http://documentation.mailgun.com/api-intro.html#authentication.但话虽如此,我不会在客户端中运行它,如果我们理解正确,则需要以纯文本格式编写密钥.

猜你在找的JavaScript相关文章