I am trying to set up a Postfix mail server to take emails to a certain 
domain and redirect them to external email addresses based on LDAP 
information.  I am new to Postfix and LDAP.  Back story -- we no longer 
want to host email accounts for a certain domain and have directed members 
of that domain to provide a "preferred" mailing address (which include 
Gmail, Hotmail, Yahoo addresses) and this server will perform that 
relay/forwarding function.  I have got the server set up and an ldapsearch 
provides the correct information based on parameters fed but when testing 
the Postfix mail delivery, the mail is misdirected to similar named 
accounts.  My successful ldapsearch command is this: ldapsearch -x -H 
ldap://ldapserver.example.com:389/ -b 
"ou=People,o=oldserver.example.com,o=example.com" -D "uid=admin, 
ou=Administrators, ou=TopologyManagement, o=NetscapeRoot" -w "bindpw" 
"(pdsLoginId=user)" mailForwardingAddress

I have these lines in my main.cf:
alias_maps = hash:/etc/aliases, ldap:/etc/postfix/ldap-virtual-aliases.cf
virtual_alias_maps = ldap:/etc/postfix/ldap-virtual-aliases.cf

The content of /etc/postfix/ldap-virtual-aliases.cf is:
server_host = ldapserver.example.com:389
search_base = ou=People,o=oldserver.example.com,o=example.com
bind = yes
bind_dn = uid=admin, ou=Administrators, ou=Management, o=VendorRoot
bind_pw = bindpw
query_filter = pdsLoginId=%u
result_attribute = mailForwardingAddress

I am using the query filter with the %u to only use the user part of the 
original email address.  I would like to forward/relay the mail to the 
mailForwardingAddress attribute from the LDAP info.  I do not have control 
of the LDAP server.  Can you suggest what I am doing wrong or point to 
appropriate how-tos that would assist.  Thank you in advance.

Reply via email to