简体   繁体   English

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

[英]Send email with Mailgun with Javascript

I'm working with JS and I have the follow code: 我正在使用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."
    }
  }); 

I need to authenticate with the apikey but i don't know where and how. 我需要使用apikey进行身份验证,但我不知道在哪里以及如何进行身份验证。

Thanks 谢谢

Mailgun API documentation has the entirety of this information. Mailgun API文档包含所有这些信息。 Look at the Authentication section specifically, http://documentation.mailgun.com/api-intro.html#authentication . 请具体查看身份验证部分, http://documentation.mailgun.com/api-intro.html#authentication However with that being said, I wouldn't run this in the client if they, and if I understood correctly, require the key to be written in plain text. 然而,话虽如此,我不会在客户端运行它,如果他们,如果我理解正确,要求密钥以纯文本写。

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

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