Below are the transport and director I am using to direct incoming mail to
our Exchange server if the user's mailbox is hosted there. This allows me to
use Exim as the "firewall", performing spam-filtering and all it's other
wonderful features.
In the LDAP query below, the SITE and ORG parameters will have to be your
_actual_ site and organization container names. This query will check to see
if the complete recipient address (local part _and_ domain name) are a valid
address for any mailbox in the Exchange directory. If so, the message is
delivered via SMTP to Exchange.
--------Cut here--------
######################################################################
# TRANPORTS CONFIGURATION #
######################################################################
local_delivery_exchange:
driver = smtp
gethostbyname = true
hosts = exchange
delivery_date_add
envelope_to_add
return_path_add
######################################################################
# DIRECTORS CONFIGURATION #
# Specifies how local addresses are handled #
######################################################################
local_user_exchange:
driver = smartuser
transport = local_delivery_exchange
condition = "${lookup ldap {ldap://exchange/ou=SITE,o=ORG?cn?sub? \
(| \
(mail=${quote_ldap:$local_part@$domain}) \
(othermailbox=${quote_ldap:smtp\\$$local_part@$domain}) \
)} {$value} fail } \
"