> ## Content Index
> Fetch the complete content index at: https://kudithipudi.org/llms.txt
> Use this file to discover other available public pages before exploring further.

# HOW TO : Block outbound e-mails in Postfix
- URL: https://kudithipudi.org/how-to-block-outbound-e-mails-in-postfix/
- Published: 2009-05-15T23:49:23.000Z
- Updated: 2009-05-15T23:49:23.000Z
- Description: I ran into a challenge at work, where we had to allow e-mail delivery for certain domains, but block all other domains. But at the same...
- Author: admin
- Tags: HOWTO, Linux, Uncategorized, #wp, #wp-post, #Import 2026-08-23 02:32

I ran into a challenge at work, where we had to allow e-mail delivery for certain domains, but block all other domains. But at the same time, we had to ensure that the clients sending e-mails did not get a delivery error. We were using [Postfix](http://www.postfix.org/?ref=kudithipudi.org) as the [MTA](http://en.wikipedia.org/wiki/Mail%5Ftransfer%5Fagent?ref=kudithipudi.org) running on [Redhat Linux](http://en.wikipedia.org/wiki/Redhat%5FLinux?ref=kudithipudi.org). Here’s how I resolved it

- Edit the main.cf file (the default location is in /etc/postfix) and add “transport\_maps = hash:/etc/postfix/transport” (without the quotes) to the file.
- Create a file named “transport” in /etc/postfix, if it doesn’t exist
- Add the following at the end of the transport file

`DOMAIN1 :  
DOMAIN2 :  
* discard:`  

- Run “postmap /etc/transport” to create a hash of the transport file
- Run “service postfix restart” to restart the postfix service

This configuraiton will ensure that all e-mails address to DOMAIN1 and DOMAIN2 are delivered normally, but the rest of the e-mails are silently discarded.

Note : Ensure that you follow the syntax for where to place the : verbatim.