DirectAdmin how to set an external email server for Domain Pointers

If you ever created domain pointers in DirectAdmin, you may have wondered how to set the domain pointer NOT to process email locally.

For instance say you have PRIMARYDOMAIN.com as the main domain under your DirectAdmin account--and it is set NOT to process emails locally, but rather have an external email server handle that; Under MX Records you un-checked "Use this server to handle my emails. If not, change the MX record and uncheck this option". So now you decided to create a "domain pointer" under that same account for another domain SECONDARYDOMAIN.com ... You set the proper MX records for this domain pointer under DNS settings, pointing to the external mail server, and think you're all good to go...

Well... Interestingly enough, this SECONDARYDOMAIN.com domain pointer does NOT share the same email processing settings, and MORE IMPORTANTLY, there is no way to set the mail processing settings for a "domain pointer" under DirectAdmin control panel.

Logically, one would assume that if the PRIMARYDOMAIN.com was set NOT to process email locally, then the SECONDARYDOMAIN.com (domain pointer) would follow the same settings. Right? WRONG! Not only does it NOT follow the PRIMARYDOMAIN.com settings, but also the SECONDARYDOMAIN.com (domain pointer) has no control panel settings available. Meaning, it will always process email locally, no matter what the PRIMARYDOMAIN.com settings are.

So... How do we change this?

We'll need to go into SSH, and set this by hand. First let's confirm that our email is in fact being processed locally.

# Confirmhow our email is being routed--you'll notice that it's checking /etc/virtual/domains 
exim -d -bt [email protected] 

So now that we can see that Exim is using /etc/virtual/domains to see if it is to handle the email locally; i.e. if exim sees that the domain exists in /etc/virtual/domains then it will process it locally. IF it does not see it in /etc/virtual/domains, THEN it will NOT process it locally--this is what you want if using an external email server. So simply enough, we just delete the SECONDARYDOMAIN.com (domain pointer) from /etc/virtual/domains--this is the same thing as un-checking the MX settings checkbox "Use this server to handle my emails. If not, change the MX record and uncheck this option"

vi /etc/virtual/domains 
# and now delete the SECONDARYDOMAIN.com listed in it 
service exim restart && service dovecot restart 

OR you can reboot the server after, just to be sure

reboot
Tags: exim DirectAdmin Linux Administration