Eric Magutu wrote:
Hi,
I am currently using exim and was doing and installation on postifx. I needed postfix to accept mail for domain.com <http://domain.com> and deliver the email to 2 different servers a local and remote without configuring forwarders. We have implemented this in exim but would like to do the same with Postfix.

Can someone shed some light on how to configure this? If you have a better way to achieve the same thing without the use of forwarders I'm open to suggestions.

--
Regards,
Eric Magutu


To send mail to an additional destination, you need to add an additional recipient. Use virtual_alias_maps to add a second recipient, transport_maps to direct the mail where it should go, and smtp_generic_maps to rewrite the address back to the original form as it's transmitted.

A basic example:

main.cf:
virtual_alias_maps = hash:/etc/postfix/virtual

virtual:
[email protected]  [email protected] [email protected]

Then use a transport table entry to route the new mail to the proper server.
main.cf:
transport_maps = hash:/etc/postfix/transport

transport:
new.example.com  relay:[192.168.192.168]

Then use a pcre smtp_generic_maps to rewrite the recipient back to the original domain when postfix sends the mail.
main.cf:
smtp_generic_maps = pcre:/etc/postfix/smtp_generic.pcre

smtp_generic.pcre:
/^(.*)@new\.example\.com$/  [email protected]


Important Notes:
Do not change your current setting for virtual_alias_domains.
Do not use wildcard or regexp rewrites in virtual_alias_maps; each recipient must be listed individually.

  -- Noel Jones

Reply via email to