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
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:
Find:
And change it to:
In case of multiple domains, it would be:
In the end, run:
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
In your SSH, as root, run:
Code: Select all
mcedit /etc/exim4/exim4.conf.template
Code: Select all
domainlist local_domains = dsearch;/etc/exim4/domains/
Code: Select all
domainlist local_domains = !domain.com : dsearch;/etc/exim4/domains/
Code: Select all
domainlist local_domains = !domain1.com : !domain2.com : dsearch;/etc/exim4/domains/
Code: Select all
systemctl restart exim4
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