procmail
[Top] [All Lists]

Re: Return addresses

1997-06-28 07:24:00
At 11:27 AM 6/27/97 -0500, Dennis A. Schmitz wrote:

[snip]

# known problem: when stripping the headers from a mail, multiple entries
# may appear (e.g. when from: and reply-to: are the same).
 
# todo find better way to eliminate dupes
 
# todo sort resultant list
 
:0 hc: addgrey.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 $GreyList >> 
$GreyList)

It looks to me like you could get rid of your dupes by changing
        | grep ...
to:
        | sort -u | grep ...

Or, since occasional dupes aren't really harmful, you could combine that with
occasional sorting instead (assuming you don't want to run the whole file
through sort every email), being sure to lock addgrey.lock in any case:
  -> by hand, or
  -> from a cron job (daily?), or
  -> only when you add something to it (requires breaking up your pipeline), or
  -> randomly from occasional emails.

As an example of the latter, following the above recipe with:
        :0 Ahic: addgrey.lock
        * ^From .*:..:[03]0
        | sort -u -o $GreyList $GreyList
should sort the file, deleting duplicates, whenever the seconds of "From "
are 00 or 30, or on average one of every 30 emails reaching this recipe.

Hope that helps,
Stan

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