Unable to send email to an external mail server whose domain is configured in domain

I was facing a peculiar issue where I need to send mail to [email protected] eyrie.in was one of the virtual servers enabled in Virtualmin. So when I tested email from command line (mutt/postfix), I got this in /var/log/mail.info:

tac /var/log/mail.info | less:
May 6 07:49:55 server postfix/bounce[19314]: 26C8F41C45: sender non-delivery notification: 4D37341CD0
May 6 07:49:55 server postfix/cleanup[19312]: 4D37341CD0: message-id=<[email protected]>
May 6 07:49:55 server postfix/error[19313]: 26C8F41C45: to=, relay=none, delay=0.22, delays=0.14/0.01/0/0.07, dsn=5.1.1, status=bounced (User unknown in virtual alias table)
May 6 07:49:55 server postfix/qmgr[19274]: 26C8F41C45: from=, size=802, nrcpt=1 (queue active)

After a variety of tests, I found that the reason was because virtualmin enabled user aliases lists for all domains configured in it. There was an option hidden in to disable mail for those domains from within virtualmin. So go here:

Virtualmin > Domain > Edit virtualserver > Enabled features
Untick the following:
Mail for domain enabled?
Virus filtering enabled?
Spam filtering enabled?

Unless the latter two are disabled, you wont be able to disable mail for that domain. Once this is done, reload postfix with:

/etc/init.d/postfix reload

You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.