View Single Post

  #3 (permalink)  
Old 03-02-2006
Greg Hackney
 
Posts: n/a
Default Re: redirect all emails from an adress to another server

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




Reply With Quote