Send Mailgun Email with Javascript

I am working with JS and I have the following code:

  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 apikey, but I don't know where and how.

thank

+4
source share
1 answer

The Mailgun API documentation contains all of this information. See the Authentication section, http://documentation.mailgun.com/api-intro.html#authentication . However, I will not run this in the client, if they are, and if I understood correctly, require that the key be written in plain text.

+6
source

Source: https://habr.com/ru/post/1544140/


All Articles