Dominik Schulz:
> Hi,
>
> I'm currently planning to migrate an Exim mailserver to Postfix due to
> performance issues and security concerns.
>
> The only remaining open issue is something I'd like to call selective relaying
> - please provide a more apt name if there is one.
I can try, if you can describe what it is supposed to do.
> The Exim mailserver is configured to handle several virtual domains. If a
> recipient is not found in the virtual table, before rejecting this recipient,
> exim checks an MS Exchange mailserver via SMTP if the it would accept this
> recipient. If it does the mail is accepted and relayed to the Exchange server.
> If it does not the mail is rejected.
Postfix uses a deterministic routing model, where mail for domain
X is routed via a fixed path.
You can make per-user overrides with virtual_alias_maps or
transport_maps, and use reject_unverified_recipient to find out if
a recipient address accepts mail. But this gets messy and results
either in rejecting mail (user unknown) or accepting too much,
causing you to become a backscatter source.
The following is the simplest example that uses virtual_alias_maps
to deflect unknown users to the MS Exchange mailserver, and that
uses reject_unverified_recipient to find out if those users exist.
Postfix 2.7 and later automatically cache the reject_unverified_recipient
result.
/etc/postfix/main.cf:
virtual_alias_domains = a.example
virtual_alias_maps = hash:/etc/postfix/virtual_alias
smtpd_recipient_restrictions =
reject_unauth_destination reject_unverified_recipient
/etc/postfix/virtual_alias:
[email protected] user1@localhost
[email protected] user2@localhost
@a.example @ms-exchange-mailserver
It is also possible to marry this to virtual_mailbox_domains,
but you didn't say that you were using those.
Wietse