PostFix/VM GPL - Forward all mail to remote host


I have a Virtualmin GPL server in commercial operations for 2 years and have always struggled with the Postfix config. I would like to configure Postfix to forward all mail generated on the system to a remote host.

We run a windows server to handle all our email accounts and would like to have this set as the default destination for all mail.

I have seen this referred to as a ‘Null Client’ but I can’t seem to find any docs that relate to Virtualmin configs.

Any help would be great.


Why forward it? Why not just set the MX records to point to your preferred mail server?


The MX is pointing at my correct windows server but messages generated on the linux systems, i.e. webforms generated by formmail, still need to be routed to the external host. This is easy if all forms for each domain are going to the same email address. But if there is multiple forms per domain with different email addresses then they seem to get stuck in the local domain users mailbox.

I want a global setting to route all mail to an IP or treat all mail as external i.e. a Null host… go an lookup the MX server and send it there.

Any help would be greatly appreciated.


This is still an MX question (or it should be)–but presumably you’ve got Virtualmin setup to manage mail for these virtual servers. You need for the local mail server (postfix) to not think it is authoritative for these domains, and it will then lookup who to send it to via DNS.

So, disable mail configuration in Virtualmin (or disable it for the domains that need mail to go somewhere else), and make sure all mentions of these domains are not present in the Postfix configuration. If the name of the server is one of these domains, then you’ll also need to remove “$myhostname” and/or “$mydomain” from the mydestination parameter in Postfix.

You probably don’t want to force Postfix to always send mail out without any processing, even if I knew how to tell you to do that, as you still want mail sent to “root” to run through aliases to find its way out to where it is supposed to go (usually, you set this to your own address…or some address you check regularly, since important stuff can show up there).

In short, this is a situation of too much configuration in Postfix, rather than you needing to do more configuration–you need to remove the bits that are telling Postfix that it’s supposed to be delivering this mail locally, and it will then send it out to where it’s supposed to go.

Oh, yeah, if you’ve set “myorigin” in Postfix, unset it. This doesn’t do what people think it does, and often leads to mysterious seeming mail loops and delivery errors.

Thanks for that… I wasn’t sure if disabling the mail for each domain would do it. I’ll give it a go and see how it goes.