procmail
[Top] [All Lists]

Re: Duplicates sent from lists

2004-02-18 09:57:08
On Wed, 18 Feb 2004, LuKreme wrote:

* ? formail -xList-Post: -D 1024 listpost.cache

would the -r option then be useful?

It might, provided that you had some other check that the List-Post header
was present before using it, and as long as the message hasn't been re-
forwarded by some intervening system.

specification for which address is the "Envelope sender" and could find 
that in formails man page.  In a list post is the envelope sender the 
"Return-Path" (the list) or the "From: " (the user)?

Looking at formail.c, "envelope sender" means the address in the "From "
line, or the Return-Path if there is no "From ", or Errors-To, or 
Return-Receipt-To (!!), or Path (news articles), or Resent-Sender, and
so on down into the ordinary header sender fields.

* ? formail -xTo: -xCc: | \
    fgrep --word-regexp --fixed-strings "$(strings listpost.cache)"

so listpost.cache contains a formail -D style list of addresses?

Yes.

is there an advantage to doing that over creating a straight text file
with returns?

Only in having formail manage the cache.

I mean, the strings command is taking the cache file and returning it in
the same format as $LISTCACHE would anyway, right?

Yes.

Still, the formail -x will extract the ENTIRE TO and CC, and that's no 
good.  We need a clean list of addresses with no additional comments.

Why, really?  Is some prankster on the list going to stick the list
address in a comment on a private reply, just to fool your filter?  
Remember, at this point we're only grepping, not extracting strings that
need to be stored somewhere.

The point of --word-regexp is to force the strings from the cache to match
only full addresses in the extracted headers.  Yes, there would be a false
hit comparing (say) foo(_at_)bar(_dot_)com to foo(_at_)bar(_dot_)com(_dot_)jp, 
but the odds of anyone
being subscribed to two *distinct* lists whose names differ only in the
country-code part of the domain are pretty small.

BTW, doesn't fgrep imply --fixed-strings?

Yes, it does.  I was scribbling without testing, and I wasn't sure that
"separated by newlines" applied to the pattern passed as a command line
argument in the absence of that explicit option.

The best choice is probably     fgrep -w -e "$(strings listpost.cache)"
(just in case the cache has a string beginning with a hyphen).


_______________________________________________
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>