Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

is there any form to prevent local delivery on a postfix server?

Ideally, I want to avoid local delivery to some domains, because this postfix server is a google apps backup one.

Thanks in advance, Simon.

share|improve this question
up vote 13 down vote accepted

In order for postfix to know not to deliver mail for a domain locally, you will need to make changes to a few (if relevant to your setup) config variables in - from the official postfix docs, you'd need to make sure you remove all domains you don't want to be treated as local from the following variables:

  • mydestination: this usually contains the list of domains delivered locally
  • local_recipient_maps: lookup table containing local recipient addresses
  • local_transport: default transport for local mail - change if inet_interfaces or proxy_interfaces match the destination of a mail
  • virtual_mailbox_domains: same as mydestination, if you're making use of it

Beyond that, I recommend you:

  • use postconf at the command line to get quick access to the current values in postfix configuration variables (man postconf for more detail)
  • visit the postconf/ info page on the official postfix site for all the details

Yes, postfix can be complicated - but that's the beauty of its configurable nature.

Hope this helps!

share|improve this answer

I found this question and response by searching specifically around this issue but in the context of Plesk. It seems under som configurations (maybe dependent on your hosting provider), Plesk likes to assume postfix is going to use local delivery no matter what. Most helpful!

Then I found and followed this article which helped resolve the issue for me:

The relevant part is:

Find your ‘’ configuration file for PostFix, which for CentOS 6, is located at /etc/postfix/ ...

Then, open the file up through a text editor, or in the Linux shell, and make these lines:

virtual_mailbox_domains = $virtual_mailbox_maps, hash:/var/spool/postfix/plesk/virtual_domains
virtual_alias_maps = $virtual_maps, hash:/var/spool/postfix/plesk/virtual
virtual_mailbox_maps = hash:/var/spool/postfix/plesk/vmailbox

Commented out like this:

#virtual_mailbox_domains = $virtual_mailbox_maps, hash:/var/spool/postfix/plesk/virtual_domains
#virtual_alias_maps = $virtual_maps, hash:/var/spool/postfix/plesk/virtual`
#virtual_mailbox_maps = hash:/var/spool/postfix/plesk/vmailbox`

Then, restart the Postfix service... and voila! Your email address should be receiving those emails now.

Just wanted to record that here in case someone found it helpful to know exactly the settings that worked for me.

share|improve this answer

I am not sure if this is the ideal solution, but I have a box with a single domain and this worked for me. I'm using Google Apps for email, and we have postfix installed to send out transactional emails, which end up going through sendgrid to be delivered to our site's users.

I found that postfix was filling up /Maildir with thousands of messages and eating up the disk space on my system.

I changed the following in etc/postfix/main.cnf:

mydestination = ip-{IP-ADDRESS-HERE}.ec2.internal, localhost.ec2.internal, , localhost


mydestination = localhost

Where {IP-ADDRESS-HERE} is your IP, e.g. 10-100-10-10

After rebooting postfix, I tested and messages are still being successfully sent to sendgrid and out via postfix, but now my maildir is no longer being filled with unnecessary messages.

share|improve this answer

I found below link very helpful, it shows step by step guide to disable postfix for external domain delivery.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.