Using procmail to forward a copy of mails
I am trying to setup a procmailrc rule to forward a copy of each mail to an other (external) mail address.
Here is my present rule: :0c * !^FROM_DAEMON * !^X-Loop: abcdefgh@foo.bar | formail -A "X-Loop: abcdefgh@foo.bar" -I "Cc:" -I "Bc:" | $SENDMAIL -oi -t $newaddress The problem is that the above rule does not only send the mail to "$newaddress", but also sends a copy to the address given in the "To:" field of the mail (besides, it also sends it to $LOGNAME@foo.bar). What is the problem with the above procmailrc rule? Why are all mails sent to the "To:" address, too? |
The "c" in your procmail recipe means "CC".
|
> The "c" in your procmail recipe means "CC".
Well, actually "c" does not really matter; e.g. if I modify the rule like this: :0 * !^FROM_DAEMON * !^X-Loop: abcdefgh@foo.bar | formail -A "X-Loop: abcdefgh@foo.bar" | $SENDMAIL -oi -t $newaddress then the mail will still be sent to two addresses: to the "To:" address, and to "$newaddress". I simply do not understand why? Is it sendmail or procmail that causes this unwanted behaviour? P.S. Naturally, it would be easy to have formail change the "To:" address to the same as "$newaddress", but then the user cannot find out by one glance that this is a redirected mail. (Plus there is a chance that two mails would be sent to "$newaddress", then?!) |
All times are GMT -5. The time now is 04:39 PM. |