Mailgun Domain not found: abc.com

I got the same error when I copy-pasted the curl example from Mailgun help page.

My domain was set to EU region, and I had to set the api domain to api.eu.mailgun.net instead of api.mailgun.net.

Boom! Working! :)


I am using the EU region with Mailgun and have run into this problem myself. My implementation is a Node.js application with the mailgun-js NPM package.

EU Region Implementation:

const mailgun = require("mailgun-js");
const API_KEY = "MY_API_KEY";   // Add your API key here
const DOMAIN = "my-domain.com"; // Add your domain here
const mg = mailgun({
    apiKey: API_KEY,
    domain: DOMAIN,
    host: "api.eu.mailgun.net"  // -> Add this line for EU region domains
});
const data = {
    from: "Support <[email protected]>",
    to: "[email protected]",
    subject: "Hello",
    text: "Testing some Mailgun awesomness!"
};
mg.messages().send(data, function(error, body) {
    if (error) {
        console.log(error);
    } else {
        console.log(body);
    }
});

Further options for the mailgun() constructor can be found here.

Thought I'd share a full answer for anybody that's still confused. Additionally, Mailgun Support was kind enough to supply the following table as a reference guide: enter image description here


IF:

  • your domain is an EU domain AND
  • you're using django-anymail as in Rob's answer above

THEN the ANYMAIL setting (in your Django project settings) should specify the API_URL to be the EU one, example:

ANYMAIL = {
    'MAILGUN_API_KEY': '<MAILGUN_API_KEY>',
    'MAILGUN_SENDER_DOMAIN': 'abc.eu',
    'MAILGUN_API_URL': 'https://api.eu.mailgun.net/v3'  # this line saved me!
}

Before adding the MAILGUN_API_URL I was getting this error:

AnymailRequestsAPIError: Sending a message to [email protected] from [email protected] <[email protected]>
Mailgun API response 404 (NOT FOUND):
{
  "message": "Domain not found: mailgun.abc.eu"
}