> (copy of an answer from a few days ago)
>
> To deliver to two destinations, you need two recipients.
>
> You can use a regexp recipient_bcc_maps to add another
> recipient, then use smtp_generic_maps to rewrite it back to
> the original during delivery. Use a transport_maps entry to
> direct the bcc'ed mail to the proper server.
>
> # main.cf
> recipient_bcc_maps = regexp:/etc/postfix/recipient_bcc
> smtp_generic_maps = hash:/etc/postfix/smtp_generic
> transport_maps = hash:/etc/postfix/transport
>
> # recipient_bcc
> if /@example\.com/
> /^...@example\.com$/ $...@new.example.com
> endif
>
> # smtp_generic
> @new.example.com @example.com
>
> # transport
> new.example.com smtp:new.server.example.com
>
> Be sure to postmap the hash: tables after making changes to them.
>
> -- Noel Jones
If I have a subdomain that I need to do this with, sub.domain.com,
should it he like this then?
/etc/postfix/recipient_bcc:
if /@sub\.domain\.com/
/^...@sub\.domain\.com$/ $...@new.domain.com
endif
I get this error:
warning: regexp map /etc/postfix/recipient_bcc, line 2: out of range
replacement index "1": skipping this rule
What did I do wrong?