Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Send email with Mailgun with Javascript

I'm working with JS and I have the follow 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 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.

Thanks

like image 443
user3729460 Avatar asked Jun 11 '14 10:06

user3729460


People also ask

How do I send an email via mailgun?

Send via API Run this: curl -s --user 'api:YOUR_API_KEY' \ https://api.mailgun.net/v3/YOUR_DOMAIN_NAME/messages \ -F from='Excited User <mailgun@YOUR_DOMAIN_NAME>' \ -F to=YOU@YOUR_DOMAIN_NAME \ -F [email protected] \ -F subject='Hello' \ -F text='Testing some Mailgun awesomeness!

Is mailgun API free?

Free Email API For Easy Sending. Send, receive, and track emails with Mailgun's free email API.

Does mailgun send SMS?

TextMagic, also a Mailgun customer, allows you to send notifications, alerts, reminders, confirmations and SMS marketing campaign messages to your customers, staff members and suppliers. On average, TextMagic customers are sending over 2.5M text messages around the world each month.


1 Answers

Mailgun API documentation has the entirety of this information. Look at the Authentication section specifically, 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.

like image 166
Asko Avatar answered Oct 03 '22 01:10

Asko