procmail
[Top] [All Lists]

Re: procmail with option ?

2002-01-24 02:02:05
On Wed, Jan 23, 2002 at 11:33:24PM -0600, Jeff Lamb wrote:
Alex said,
   I want to accept mails from one of senders that I have in a local
   file (address_book).
     0:
     * ? aux=`formail -X "From:" | cut -d" " -f2` &&  grep $aux
address_book
     mybox

Are there other way to do the same more easy?

Yep.  Try:

:0
* ^From:\/.+
* ? echo "$MATCH" | fgrep -i -f $addressbook
mybox

where $addressbook points to the path where you have a listing (1 per line)
of emails you want to accept mail from.

If you want to bypass the grep and pick only one sender, this will work:
:0
* ^From(_dot_)*the(_at_)email(_dot_)address(_dot_)com
mybox

He wwas closer with ihis formail method I think. He just want's to change his
match condition a little.

* ? formail -rtzxTo: | fgrep -i -f $addressbook

The reason for this is it extracts just the email address, stripped of it's
"comments", which is much easier to check against your addressbook. Extracting
"From:" could get "Foo Bar <foo(_at_)bar(_dot_)tld>" or "Bar, Foo 
<foo(_at_)bar(_dot_)tld>" or
whatever, but extracting To: from an autoreply guaruntees you'll get
"foo(_at_)bar(_dot_)tld" every time.

-- 
Andrew Edelstein        -       andrew(_at_)pure-chaos(_dot_)com
"If you're not pissed off at the world then you're just not paying attention."
                                Kasey Chambers "Ignorance"
"If you're not frightened by this, you're simply not paying attention."
                                Harry Browne
_______________________________________________
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>