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 (test1@local.test, test2@local.test 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
/./ test1@local.test
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 -> test1@local.test
10.0.0.2 -> test2@local.test
10.0.0.3 -> test3@local.test
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?
Thanks,
Best Answer
convert solution from comment to CW
Postfix SMTP server access table [man page] support REDIRECT feature
Combine this feature with check_client_access will be solution to your problem, i.e.