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

Currently my server acts as a gateway, checks AD for valid email addresses, if the email address exists in exchange it sends over the email, otherwise just rejects (typical)

I need Postfix to send any emails with specific domains to other servers (not same network).

Steps would go something like this:

get requested email
check if email exists in AD
if it doesn't exist, check if the domain is in a file and send that email to a server specified in that file

Is this even possible? I looked at smtp_fallback_relay but the second email is checked, it get rejected if not found in AD

share|improve this question

Postfix will verify validity before any routing is performed, so that order must be respected.

Put your valid recipient lists for exchange and the other destinations in one of the appropriate maps, and then put both in sequential transport_maps; you can make it not change the routing by just specifying smtp: as the RHS.

share|improve this answer
Let's say I have something like this: relay_recipient_maps = ldap:/etc/postfix/, hash:/etc/postfix/secondary /etc/postfix/secondary would have something like: OK How can i have two transport maps for the same domain, and only use a particular transport map depending on if the email address is located in exchange? If an address is in exchange, use trasport_map1, but if it doesn't, use transport_map2. – luthan Jan 31 '13 at 16:38
In the way I indicated above: place one after the other. – adaptr Jan 31 '13 at 16:43
but i would have to have domain listed in both transport tables, just with different destinations. wouldn't the first transport table be used at all times? assume that i do not know the exact email addresses hosted at the remote server. – luthan Jan 31 '13 at 17:12
i noticed that if i specify the exact email address in the second transport map, the setup works. however, if i set it up as catchall (, that gets ignored and the first transport table is used. – luthan Jan 31 '13 at 17:29
Don't use catchalls. – adaptr Jan 31 '13 at 18:11

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.