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

Post Reply
User avatar
isscbta
Team Member
Posts: 137
Joined: Mon Jul 19, 2021 1:41 am
Has thanked: 17 times
Been thanked: 3 times

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

Tags:
User avatar
webxtek
Posts: 51
Joined: Wed Nov 18, 2020 7:43 pm

really good thread, thanks for creating it
Post Reply