"User unknown in virtual alias table" Error in Postfix and Virtualmin

In Linux, Web by Kevin MaschkeLeave a Comment

I recently came accross a strange issue with Postfix and Virtualmin on every website hosted on my server when someone tried to send a mail using a contact form. The websites stated that the email had been sent correctly, but the email never reached the inbox.

Checking the logs in /var/log/mail.log I saw that the emails were not being sent and that the following error message was being written to the logs:

Jun 21 09:39:32 server postfix/pickup[74857]: 82A542019B6: uid=1007 from=<domain>
Jun 21 09:39:32 server postfix/cleanup[76834]: 82A542019B6: message-id=<5cc7985adece5aec72a03de385612e5d@www.domain.com>
Jun 21 09:39:32 server postfix/qmgr[1746]: 82A542019B6: from=<domain@server.host.com>, size=790, nrcpt=1 (queue active)
Jun 21 09:39:32 server postfix/error[76836]: 82A542019B6: to=<info@domain.com>, relay=none, delay=0.09, delays=0.04/0/0/0.05, dsn=5.1.1, status=bounced (User unknown in virtual alias table)

Postfix was bouncing the emails with a “User unknown in virtual alias table” error.

I searched the web and did various tests following the recommendations and steps I found on the official Virtualmin forums, changing the configuration of Postfix, checking and changing the domain configuration within Virtualmin and even changing some settings through Webmin, but the error persisted.

Cause and solution!

Finally, I found out that if you send a mail from a website that’s hosted on Virtualmin, the server will always first look if the destination domain you’re sending the mail to exists in Virtualmin on the local server. If it does, it’ll try to send the domain to the specified account, which will probably not exist (unless you’re also using Virtualmin as mail server) and fail.

Since I do not use Virtualmin as a mail server but only as a web server, it’s possible to fix the problem by disabling the following options in “Virtualmin > Domain > Edit Virtual Server > Enabled Features”:

  • Mail for Domain
  • Spam Filtering
  • Virus Filtering

It’s important to disable all three options, because if not the mail functions for the domain will still partially be enabled and the error will continue to occur.

Once the options are disabled and the configuration has been saved, it’s advisable to reload Postfix to make sure it applies the new configuration:

/etc/init.d/postfix reload

In case you use Virtualmin also as a mail server, the problem will most probably be that the email account you’re trying to send the email to does not exist for the domain and has to be created.

Want to say something? Leave a comment!