I have a test postfix (2.6.6) server configured to intercept all outbound emails and store them locally, so that the devs can test email functionality of client apps without spamming the world.
The server accepts mail for @local.test, and accepts mail from servers defined in a cidr mapping table:
127.0.0.0/8 OK 10.0.0.0/24 OK
The test server has 5 virtual users (firstname.lastname@example.org, email@example.com etc.), and postfix is configured as both the MTA and LDA as described in the VIRTUAL_README.
I can configure the server to redirect all relayed mail to one of the local accounts using recipient canonical classes/maps, as described in this blog post.
recipient_canonical_classes = envelope_recipient recipient_canonical_maps = regexp:/etc/postfix/recipient_map /./ firstname.lastname@example.org
But what I'd like to do now is redirect mail based on the ip address of the source server sendng the mail, so for example:
10.0.0.1 -> email@example.com 10.0.0.2 -> firstname.lastname@example.org 10.0.0.3 -> email@example.com
There's only a few of these, so I don't need any dynamic mapping, just a simple config file would do.
Anyone have any clues how I could do this?