procmail
[Top] [All Lists]

Re: Return addresses

1997-06-26 11:30:00
bts8(_at_)netcom(_dot_)com wrote:

I'm trying to gather return addresses of people I regularly receive mail
from prior to setting up any autoresponse system.  I would like to
capture these addresses into a file to check against in the future.
I currently have:

:0c:
* ! ^FROM_DAEMON
* ! ? echo $FROM | $GREP -v -F -i $PMDIR/friendlygather
* ^TO_bts8\>
| echo $FROM >> $PMDIR/friendlygather

What I expected was that this recipe should make sure incoming mail is
not from a daemon, that the address is not currently in the
friendlygather file, and finally, that this piece of mail is
specifically addressed to me (to avoid bcc spams).  Unfortunately, this
recipe doesn't add any new addresses to the friendlygather file.  The
friendlygather file currently has only one line in it which is "test" (no
quotes).  Any ideas are greatly appreciated!  Thanks!

This is what I use. It depends on already filtered emails, so you'll
have to do that yourself. I put the '>' in to keep netscape from
splitting up the lines. It is important that the sed macro have the
escaped newline in the right place. The sed macros strip realnames in a
very simplistic fashion, so don't count on any seriously-weird-yet-valid
addresses to be stripped properly.

Unfortunately, it leaves a duplicate entry in the list if it appears in
more than one of the fields extracted. You could avoid this by only
extracting one at a time, but then you'd be running the command four
times instead of once and it wouldn't guarantee against having the same
email address included twice in the same header.

If you think of a clean way to remove duplicate entries and to
periodically sort the list, let me know.

:0 hc: add.lock
| (formail -z -c -x from: -x reply-to: -x to: -x cc: | sed -e's/".*"//g' 
-e's/(.*)//g' -e's|,|\
|g' -e's/^.*<//' -e's/>.*$//' -e's/ //g' | grep -vwiF -f $List >> $List)

-- 
Dennis Schmitz                   email: den(_at_)lucent(_dot_)com
Lucent Technologies              Phone: (708) 979-7841
IH 6H-338                          Fax: (708) 979-3439
2000 North Naperville Road
Naperville, IL 60566-7033

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