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 as the MTA running on Redhat Linux. 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.
This works perfectly so thank you.
Hi, does this allow/deny incoming emails, or outgoing emails from the same server?
Anyone know how to do the opposite? I need to block one domain and allow all others.