Postfix as mail relay for Exchange


Taken from however note that the "your_recipients" file in the postfix, the "plusone_recipients" in the cron job, and the "example_recipients" in the Perl file should probably all be the same. -- wl 200808

This method consists of a simple perl script which uses Net::LDAP to retrieve Active Directory users' "proxyAddresses" which are both primary and secondary SMTP addresses (as opposed to using "mail" which would only retrieve a user's primary SMTP address). Nothing needs to be run on the Active Directory domain controllers; this script requires only TCP port 389 access to your Active Directory domain controllers

The resulting output is in the format: " OK" which then must be postmap(ped).

Add the following to your Postfix 2.0+ to use the relay_recipient_maps feature of Postfix, which will now reject unknown users:

relay_recipient_maps = hash:/etc/postfix/your_recipients

Note: the Exchange domains in question MUST be entered in relay_domains, and NOT in mydestination.

Also note if you would like to prevent Postfix from rejecting with "User unknown in relay recipient table" and would rather Postfix say "User unknown" set show_user_unknown_table_name = no in

I have the script cronned every hour with the following cron job:

cd /etc/postfix ; ./ && postmap plusone_recipients

Conceivably this script can be easily modified to support other LDAP servers by changing the M$-specific "proxyAddresses" search base and output modification.