Virtual Server without mailboxes

[edit] Moved to probably a more appropriate forum[/edit]

I’ve been trying to create a Virtual Server so that any emails sent using the mail() function to an address within my domain are not sent locally, but using the correct MX records like it does with domains not hosted within Virtualmin.

The email for my domain is hosted with gmail and all the MX records are correctly set up.
I am hosting the website on my Ubuntu box and have the following options selected when setting up the Virtual Server:

Setup DNS zone? NO
Allow Mailman mailing lists? NO
Accept mail for domain? NO
Setup SSL website too? NO
Setup IP-based virtual FTP? NO
Setup website for domain? YES
Enable AWstats reporting? YES
Setup Webalizer for web logs? YES
Create MySQL database? YES
Create Webmin login? YES
Enable DAV logins? YES

Any thoughts as to why I get the below in /var/log/mail.log, the first message to anotherdomain works fine, but the one to mydomain goes internally (the Google server shown is because anotherdomain MX is also hosted with Google):

Sep 10 04:06:22 as postfix/smtp[14159]: 7D96389A3C7: to=,[]:25, delay=3.2, delays=0.71/0/0.43/2.1, dsn=2.0.0, status=sent (250 2.0.0 OK 1315623982 u16si1881075vcq.207) Sep 10 04:06:22 as postfix/qmgr[11385]: 7D96389A3C7: removed

Sep 10 04:06:43 as postfix/pickup[25633]: 4F2BA89A3C7: uid=1003 from=
Sep 10 04:06:43 as postfix/cleanup[14145]: 4F2BA89A3C7:
Sep 10 04:06:43 as postfix/qmgr[11385]: 4F2BA89A3C7:, size=348, nrcpt=1 (queue active)
Sep 10 04:06:43 as postfix/error[17746]: 4F2BA89A3C7:, relay=none, delay=0.36, delays=0.19/0/0/0.17, dsn=5.0.0, status=bounced (User unknown in virtual alias table)
Sep 10 04:06:43 as postfix/cleanup[14145]: 91B2589A3C8:
Sep 10 04:06:44 as postfix/qmgr[11385]: 91B2589A3C8: from=<>, size=2079, nrcpt=1 (queue active)
Sep 10 04:06:44 as postfix/bounce[17778]: 4F2BA89A3C7: sender non-delivery notification: 91B2589A3C8
Sep 10 04:06:44 as postfix/qmgr[11385]: 4F2BA89A3C7: removed
Sep 10 04:06:44 as postfix/local[17790]: 91B2589A3C8:, relay=local, delay=1, delays=0.43/0.01/0/0.59, dsn=2.0.0, status=sent (delivered to command: /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME)
Sep 10 04:06:44 as postfix/qmgr[11385]: 91B2589A3C8: removed

Any help would be greatly appreciated.

Moved to a different forum as I’m not sure if Virtualmin was the right forum. Any help would be greatly appreciated.

If emails are being sent locally, even though you’ve disabled the “Mail for Domain” feature – that means Postfix thinks that mailbox is local… perhaps due to an old/incorrect entry in the virtual file.

Take a look at /etc/postfix/virtual – if the domain “” on your server does not have Mail for Domain enabled, then “” should not appear anywhere in that file. So, poke around in there and make sure that’s the case :slight_smile:

If you find any references to do, you may want to delete those, and then run this command afterwards:

postmap /etc/postfix/virtual

Thanks for your reply, andreychek, that has worked a treat. Thank you so much for your help. :slight_smile: