I administer a domain (let's say example.com
) for a client who uses an Exchange server at an external service provider for email. So I made the MX record point to the Exchange server, let's say mail.provider.com
. Now I want email to a single address me@example.com
forwarded to my own email account me@me.com
. Unfortunately, the service provider told me that they're not able to do this for some reason.
Since I have control over the MX record, my idea is to make it point to my own server running Postfix and
- forward email to
me@example.com
tome@me.com
- relay all other addresses to
mail.provider.com
The solution I came up with is to add the domain to relay_domains
and set up a Postfix transport map
relay_domains = example.com
transport_maps = hash:/etc/postfix/transport
that contains
me@example.com virtual:
example.com :[mail.provider.com]
.example.com :[mail.provider.com]
Then add an entry to the virtual alias map
me@example.com me@me.com
I think this should work but it looks a bit ugly. Would this work at all? Is there a nicer solution?
Best Answer
Instead putting me@example.com in transport_maps, you can skip that step and use
virtual_alias_maps
directly.Virtual alias maps is special mapping in postfix that overrides email aliasing regardless their domain class. You can use it for relay_domains, local_domains, or virtual_mailbox_domains.
Beside technical point, I would also point out that your client will aware that your server sit in front of their real server. They may think that you are snooping their conversation. You should think the some implications from this method.