user3729460
user3729460

Reputation: 59

Send email with Mailgun with Javascript

I'm 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 <[email protected]>",
      "to": "Jordi <[email protected]>",
      "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 domain so you can send 10,000 emails/month for free."
    }
  }); 

I need to authenticate with the API key but I don't know where and how.

Upvotes: 5

Views: 9487

Answers (1)

Asko
Asko

Reputation: 306

Mailgun API documentation has the entirety of this information. Look at the Authentication section specifically, https://documentation.mailgun.com/docs/mailgun/api-reference/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.

Upvotes: 10

Related Questions