procmail
[Top] [All Lists]

Re: Formail skipped & match wrong

2001-08-27 01:26:45
On Sun, Aug 26, 2001 at 01:58:56AM +0700, Tim Rice wrote:
I want to grab the from address from any email with reservation in the
subject, add it to a file called "whitelist" then deliver it.

Thanks in advance.

:0
* ^Subject:.*reservation 
{ 
:0
formail -x"From:"\/ \ 
$MATCH >> $TESTDIR/whitelist
:0:
$DELIVER
}

What you want is:

:0c:
* ^Subject:.*reservation
| formail -rzxTo: >> $TESTDIR/whitelist

:0A:
$DELIVER

Since you're writing to a file you need a lock, lest two (or more) instances
clobber eachother. To invoke formail, you need a pipe. -rxTo: tells formail to
create an auto-reply header back to the sender, then extract the To: field
from that new header. This gives you the email address of the original sender
stripped of "Real Name" comments.

-- 
Andrew Edelstein        -       andrew(_at_)pure-chaos(_dot_)com
http://andrew.pure-chaos.com
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>