Make Postfix stop considering domains as local


is there any way to make Postfix stop considering certain virtual domains as "local" in its delivery?

I have disabled mail services for these domains by editing the "enabled features" in Virtualmin, because the mail is handled externally by google-apps, but when trying to send mail to one of these domains from within their website, Postfix still thinks that it should deliver them locally and consequently bounces the mail since there is no user by that name.

I checked the "virtual domains" table in Webmin->Servers->Postfix, and the domains are not listed there.

This is on a Debian 4 installation that was created by running the Virtualmin GPL installation script.

Check mydestination. It probably contains the offending hostname, or a variable that contains that name.

Oh, yeah, and relay_domains.

Many thanks for your suggestions!

mydestination is set to the name of the whole server, it doesn’t show any of the virtual domains.
> mydestination =

relay_domains isn’t defined at all (so it defaults to mydestination)

The entire Postfix setup is as Virtualmin defined it during installation …

Where does Virtualmin store the table of virtual domains that it sets up mail services for?

<hash:/etc/postfix/virtual> seems to list only the exception mappings, and I did remove the domains that i am trying to stop Postfix from treating as local, but it still says it’s looping back to itself when trying to send mail to an address in one of these domains.

Where does Virtualmin store the table of virtual domains that it sets up mail services for?


It sounds like your systems hostname is actually the domain you’re trying to send elsewhere, and you just don’t realize it. :wink:

Postfix gets this from a gethostbyname call, and not from the various hostname configuration files. What do you get when you run:

hostname -f


hostname -f gives:

This is the domain name that Hetzner gave to the physical machine hosting Virtualmin with IP

The domain whose mail i am trying to off-load is, with a different IP ( - Non-default shared address)

"Mail for domain enabled?" is deactivated in the Virtualmin domain feature list, yet when a webscript sends out mail to, Postfix tries to deliver it locally.

That’s really strange. But I guess you know that already. :wink:

Does grep find that domain anywhere in /etc/postfix?


cd /etc/postfix
grep -R *

As a work-around, i found that I could add an entry to the transport mappings to explicitly direct outgoing mail to the google server that’s hosting mail services for

That’s the only line that grep found in etc/postfix

This way, I do manage to get the mail out, but I was hoping I could just get Postfix to ignore any special handling and treat this a non-local domain.

But don’t waste your time any more on this, I really appreciate your efforts !

How about the MX record? (Can you tell I’m bothered by not being able to figure this out?) :wink:

Yes, it is very nagging not to know the reason!

At the level of the public domain name server, the two MX entries point to the google-server:

But on the local BIND-DNS record, there is one line mentioning MX locally – should I try to take that out? (but it actually looks like a spam filter entry, no?):

$ttl 38400
@ IN SOA (
38400 )
@ IN NS IN A IN A IN A IN A IN A IN TXT "v=spf1 a mx ip4: ?all" IN A IN A IN A IN CNAME

That’s the SPF record, and shouldn’t be confusing Postfix. You could try removing it temporarily (but you’ll want it back, eventually, and you’ll want to add the Google outgoing servers if you use those for outgoing mail from your domain).

Hi Joe,

A friend finally pointed me in the right direction to solving the mystery!

The solution was to add MX records to the local BIND server, that point to the remote server that’s meant to handle the mail: IN MX 10 IN MX 20

In the absence of the MX records, Postfix seems to somehow think that because the www ip is local, so is MX, rather than look up the MX entries in the registrar’s name server (which did already have the above definitions).

Many thanks for your help on the way!