Is it possible to configure postfix to relay email to a new server for only some addresses without changing the address.
I'm testing a new email server (in this case, Office365). I want to test with a user user@example.com who is currently receiving email locally. I want to configure postfix to send user@thursby.com email to example-com.mail.protection.outlook.com without changing the address (user@example.com). I want to do this to verify delivery before changing the MX record for the domain example.com.
EDIT
Thank you for pointing me to the same question asked previously. Given that information, I was able to figure out the steps. Here's what I did:
- Edit the file
/etc/postfix/main.cf
- Add the following line near TRANSPORT MAP:
transport_maps = hash:/etc/postfix/transport
Run "postfix reload" to take new setting.
Edit the file
/etc/postfix/transport
- Add the following line:
username@domain.com smtp:domain.mail.protection.outlook.com:25
- Run "postmap /etc/postfix/transport" to create the hash.
- Verify that the solution work.