Page 1 of 1

How to disable local_delivery and keep domain in MAIL section for domains that is not hosting emails on our server

Posted: Wed Sep 14, 2022 12:58 pm
by isscbta
Usually, when we host some domain.com for which MX servers are pointing to another email server, the best practice is to delete domain.com from the MAIL tab to prevent internal mailing problems. But, in some cases when we have to preserve email addresses for domain.com, deleting domain.com is not a solution, so here is described what to do in that situation:

In your SSH, as root, run:

Code: Select all

mcedit /etc/exim4/exim4.conf.template
Find:

Code: Select all

domainlist local_domains = dsearch;/etc/exim4/domains/
And change it to:

Code: Select all

domainlist local_domains = !domain.com : dsearch;/etc/exim4/domains/
In case of multiple domains, it would be:

Code: Select all

domainlist local_domains = !domain1.com : !domain2.com : dsearch;/etc/exim4/domains/
In the end, run:

Code: Select all

systemctl restart exim4
Instead of domain.com, insert desired domain address.

Doing this means we don't have to delete the 'domain.com' domain from the MAIL section to prevent internal mailing problems. So in this case server will not do local_delivery for domain.com (in the case when MX records are pointing to another email server) and in another hand, we would preserve domain.com in the MAIL section in case when we need to save mail addresses

Re: How to disable local_delivery and keep domain in MAIL section for domains that is not hosting emails on our server

Posted: Thu Sep 22, 2022 3:07 pm
by webxtek
really good thread, thanks for creating it