DjangoDjango

Fixing anymail/mailgun "Domain not found" error

Oct 03, 2019 · by Tim Kamanin

Are you swearing at mailgun now? Have you smashed your keyboard already? Do you keep receiving the Domain not found: domainname.com error although you're 100% sure you've set everything up correctly?

Yeah, I've been there and probably, I have a solution for you.

Chances are, your domain is set as EU in mailgun. Make sure you use correct API base URL in this case: https://api.eu.mailgun.net/v3, note the eu part. Update example snippets that mailgun gave you with this endpoint and everything should start working just fine.

I'm on Django, and I use Anymail

Me too! Make sure you've added european mailgiun API URL to settings.py:

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

That should be it; now you're happy european mailgun user! You're welcome!

Hey, if you've found this useful, please share the post to help other folks find it:

There's even more:

Subscribe for updates

  • via Twitter: @timonweb
  • old school RSS:
  • or evergreen email ↓ ↓ ↓