One final refinement: add a "-o soft_bounce=yes" to the pipe command
as shown below (and ececute "postfix reload"). With this, when the
script fails Postfix will retry the recipient until the message is
too old.
Without the soft_bounce option, Postfix 2.2 and older report the
bcc recipient to sender, while Postfix 2.3 and later discard a
failed bcc recipient.
Wietse
Use the Postfix built-in recipient_bcc_maps feature to ADD a recipient
that resolves to your script.
/etc/postfix/main.cf:
recipient_bcc_maps = pcre:/etc/postfix/recipient_bcc
transport_maps = hash:/etc/postfix/transport
script_destination_recipient_limit = 1
/etc/postfix/recipient_bcc:
/(.*)@(the\.example\.com)$/ $1-$2@some-domain-here
/etc/postfix/transport:
some-domain-here script:
/etc/postfix/master.cf:
script unix - n n - - pipe
-o soft_bounce=yes
flags=FR user=some-user-here argv=/some/where/script $recipient
References:
http://www.postfix.org/postconf.5.html#recipient_bcc_maps
http://www.postfix.org/postconf.5.html#transport_maps
http://www.postfix.org/postconf.5.html#transport_destination_recipient_limit
http://www.postfix.org/transport.5.html
http://www.postfix.org/master.5.html
Wietse
-------------
So this works wonderfully. It does everything as expected, except the
forwarding after the script has run. I added the IP of the server in
relayhost:
relayhost = [192.168.10.1]
But it acts like it's not even paying attention to that.
This is the only thing that doesn't seem to be working properly.
Any thoughts?
>
> What are you trying to do here ?
> You want to relay the original message offsite, or the copy ?
>
> The original message will go where it will go, you don't have to do anything
> for that.
>
> Since you archived the copy, what else do you want to do with that ?
>
> --
> J.
> -----------------------
>
> after much persuading, I think this thing is working. Sorry for the false
> alarm on this last part.
>
> Thanks for everyone's help, it's greatly appreciated.
>
>
>