How to send email with Mailgun

I'm trying out the "send email with Mailgun" plugin but I can't make it work.

I already set up an account with Mailgun and was following the instructions written by Max ( for Mailgun, which appear to be outdated.

I found this topic ( in which Max says not to use a proxy anymore but to use the code below on a Server Code script. I used the code but it's not working for me.

1. Is the code still the one we should use?
2. In the url, can I use my domain as "" if I have set it up on Mailgun?
3. Do I need the API key specific to my domain or a general "user" API key?

var url = "";
var XHRResponse = XHR2.send("POST", url, {
"parameters": {
"from":"Excited User ",
"subject": "Email subject",
"text": "Hello from"
"headers": {
"Authorization": "Basic base64string (api:abc...)"
Apperyio.response.success(XHRResponse.body, "application/json");

1 person has
this question