> From: owner-postfix-us...@postfix.org [mailto:owner-postfix- > On Mon, Aug 10, 2015 at 07:58:56PM +0000, Rosenbaum, Larry M. wrote: > > > I would like to do the following: If the recipient is > > u...@mail.example.com, rewrite the address to u...@example.com and relay > > it to server exch.example.com. How would we do this? > > http://www.postfix.org/ADDRESS_REWRITING_README.html#virtual > http://www.postfix.org/virtual.5.html > http://www.postfix.org/postconf.5.html#virtual_alias_maps > http://www.postfix.org/transport.5.html > http://www.postfix.org/postconf.5.html#transport_maps > http://www.postfix.org/postmap.1.html > > main.cf: > indexed = ${default_database_type}:${config_directory}/ > virtual_alias_maps = ${indexed}virtual > transport_maps = ${indexed}transport > > virtual: > u...@mail.example.com u...@example.com > > transport: > example.com relay:[exch.example.com] > > You can use LDAP to do the rewriting: > > http://www.postfix.org/ldap_table.5.html > > main.cf: > ldap = proxy:ldap:${config_directory}/ > virtual_alias_maps = ${ldap}virtual.cf > > virtual.cf (owner root, mode 0700): > server_host = ldap.example.com > search_base = dc=example,dc=com > bind_dn = ... DN of some account object ... > bind_pw = ... corresponding password ... > query_filter = proxyAddresses = smtp:%s > result_attribute = mail > > Test all mappings with "postmap -q".
Thanks. One more thing - there will also be other mail with a @example.com address that does NOT go to exch.example.com - some will go to e.g. list.example.com, dept.example.com, etc. So it looks like the rewriting and the transport/relay stuff needs to happen at the same time. Is that possible?