Exim Multiple domains with Mailgun

Hello friends,
I am looking to configure exim to run multiple mail domains with mailgun.
I used Pluto’s solution from the article:


This solution is running fine but only with one domain, if I use another domain in exim to send mail through the domain user entered in exim4.conf.template will have authentication issues and spam messages immediately.
I have tried many methods and still to no avail. this is possible to run multiple domains: https://serverfault.com/questions/910752/exim-smarthost-multiple-domains-and-credentials-mailgun
I tried it but it didn’t work for me.
Currently many VPS providers have blocked port 25, I cannot send mail from my server and have to go with an external SMTP service.
Please any help or solution to solve the mail server problem.
Thanks for your time.
P/s: HestiaCP was great for me after trying out many other panels.

Please share what you’ve tried - probaly you could just hardcode them over the "domains = "-variable.

1 Like

Hi ScIT, Thanks for reply.
My temporary workaround is use a TXT record for other domains to send valid mail through the primary domain’s mailgun user:

  • Set up the primary domain to send mail using Mailgun, ex: “sender.primarydomain.com
  • Configure Exim.conf.template to deliver mail using the smtp mailgun user from sender.primarydomain.com.
  • Other domains point a TXT record to “v = spf1 include: sender.primarydomain.com ~ all”. (For webmail to send valid mail).
  • With wordpress or mail client app … still use SMTP directly from the mailgun user for each domain.
    —> The results I have checked from mail-tester.com:
    (Still looking for a better solution with HestiaCP - exim - VPS locked 25 port).

Send by webmail using directly smtp user sender.primarydoamin.com:

*Send by webmail using TXT record to “v = spf1 include: sender.primarydomain.com ~ all”. (other domain)