procmail
[Top] [All Lists]

Re: How to use procmail to forward mail under conditions

1999-05-20 13:10:15
On Thu, 20 May 1999 tomers(_at_)excite(_dot_)com wrote:

Hi
I would like to perform the following algorithm:

if (To == "email1(_at_)host(_dot_)com" )
then {
 add "Misc" field and write orginal "To" to it;/*optional*/
 write "email2(_at_)host(_dot_)com" in "To" ;
 forward message to "email2(_at_)host(_dot_)com" (without saving) ;
}

try this (requires procmail 3.11pre7 or later for the ^TO):

:0
* ^TO_email1(_at_)host(_dot_)com
!email2(_at_)host(_dot_)com

That one doesn't actually rewrite the "To:" field. Assuming
you just want the mail to get to 'email2', that'll do what you want.
If you want to also rewrite the "To" field,

:0
* ^TO_email1(_at_)host(_dot_)com
|formail -i "To: email2(_at_)host(_dot_)com" | $SENDMAIL -t -oi

(double-check me on those sendmail flags).

-jeff
-- 
On March 29, the Dow Jones made history, closing above 10,000 points for
the first time ever. What do you think about Wall Street's unprecedented
vigor? "Some say money is the root of all evil. Then again, some say love,
it is a river that drowns the tender reed." Jen Kobel, Set Designer
http://www.theonion.com/onion3513/wdyt_3513.html