benjamin.sebbah@gmail.com wrote:
> Hello,
>
> When I receive an email,
> if the user "TO" is in my LDAP directory then send email correctly
> if the user is not in the LDAP directory but the domain is ok, forward
> it to another server with another IP.
>
> Thanks
I haven't tested this scenario, but I think you could do it like this:
In the transports configuration, perform an LDAP lookup for existing
email addresses, and if they exist, use the "local:" transport.
If not, route that domain's traffic to the other server.
--< main.cf >--
transport_maps = ldap:/etc/postfix/ldap.cf,
proxy:hash:/etc/postfix/transport
--< transport >--
@mydomain.com smtp:[server2.mydomain.com]
--< ldap.cf >--
bind = no
domain = mydomain.com
timeout = 120
search_base = o=MyLDAPdatabaseNAME
server_host = ldap://ldap.mydomain.com
server_port = 389
query_filter = (mail=%s)
result_attribute = "local:"
--
Greg