Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to get users who meet certain criteria in our LDAP to have their mail redirected to the same email prefix at a subdomain.

For example, if a mail is received to, an ldap lookup reveals this user has been migrated to gmail and so the mail needs to be forwarded to

I'd appreciate any help anyone can provide.

Many thanks Mike Dixson

share|improve this question

Ok go it working, I was approaching it from a bit of a wrong angle before. Here's the winning config:


relay_domains = $mydestination,
virtual_alias_maps = hash:/etc/postfix/, ldap:/etc/postfix/


# postmap /etc/postfix/
server_host =
server_port = 389
bind = no
search_base = dc=domain,dc=ac,dc=uk
query_filter = (&(|(mail=%s)(mailAlternateAddress=%s))(businessCategory=student)(eduPersonEntitlement=
result_filter =
result_attribute = mail

I hope that helps others with the same issue ahead of them.

Thanks Mike Dixson

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.