Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 aStudent@domain.ac.uk, an ldap lookup reveals this user has been migrated to gmail and so the mail needs to be forwarded to aStudent@student.domain.ac.uk.

I'd appreciate any help anyone can provide.

Many thanks Mike Dixson

share|improve this question

1 Answer 1

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


relay_domains = $mydestination, student.domain.ac.uk
virtual_alias_maps = hash:/etc/postfix/virtual.map, ldap:/etc/postfix/vstudent.map


# postmap /etc/postfix/vstudent.map
server_host = ldap.domain.ac.uk
server_port = 389
bind = no
search_base = dc=domain,dc=ac,dc=uk
query_filter = (&(|(mail=%s)(mailAlternateAddress=%s))(businessCategory=student)(eduPersonEntitlement=http://entitlement.domain.ac.uk/gmail))
result_filter = %U@student.domain.ac.uk
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.