Edit Transport Maps On Postfix
If you need email delivered to a specific server for selected domains you do the following:
- As root, edit the /etc/postfix/main.cf. Find (or add) the line that starts with
transport_maps=
If it does not exist, add the line “transport_maps=hash:/etc/postfix/transport.
If the line exists, add “,hash:/etc/postfix/transport” at the end of the line. Note the comma. - Edit/create the file /etc/postfix/transport and add a line like the following:
destinationdomain.com smtp:Destination.Host.Address.Or.FQDN
where:
“destinationdomain.com” is the domain name in the email address
“smtp:” you put in “smtp:”. There are other options if needed. You can check the man pages for the other options, but you will be using “smtp:” 99% of the time.
“Destination.Host.Address.Or.FQDN” is either the ip address or the name of the server that you want the email to be explicitly delivered to - execute as root:
postmap /etc/postfix/transport
- execute as root:
service postfix restart
To add additional domain names, repeat only steps 2 and 3
Delete all email destined for a selected domain or email address
Repeat the above – but add the following line(s) to the /etc/postfix/transport file
domainWeDontLike.com discard OneSelectUser@someDumbDomain.com discard
The first line will discard all email destined for AnyUser@domainWeDontLike.com. The second line will discard all email to OneSelectUser@someDumbDomain.com. Any other email addressed to a user @someDumbDomain.com will be delivered.