procmail
[Top] [All Lists]

Re: Sort into mailing list folders ...

1998-09-25 13:40:16
Excerpts from mail: (25-Sep-98) Sort into mailing list folders ... by Gunther 
Schadow
I imagine that in order to sort the crossposted mail correctly one
would have to do two things:

(1) after one match was found, the matching To/Cc address ought to be
removed from the To/Cc line and then procmail would have to try for
another match.

That's an unnecessary step, I believe.

(2) procmail would have to presort incoming mail to remove duplicates
of a messages with the same sender-assigned Message-id.

Right. I think you'd definitely have to do that.

I wonder if procmail can do that, and how other people deal with
similar problems. Any ideas?

Here's one possible implementation (off the top of my head, untested!):

# First remove duplicates.
:0
* ^Message-ID:
* ! ^Message-ID:.*MAPI.to.RFC822
{
        :0:.duplicates.lock
        * ? formail -D 8192 .duplicates.cache
        .duplicates.mbox

        # You could change ".duplicates.mbox" to /dev/null if you feel brave,
        # or just use a cron job to clean out .duplicates.mbox on a regular
        # basis.

        # See Alan K. Stebbens' dupcheck.rc for a more robust and extensive
        # solution to filtering out duplicates.
}

# For mailing lists L1, L2, L3, ... Ln
:0 c:
* ^TO_L1
L1.mbox

:0 c:
* ^TO_L2
L2.mbox

.
.
.

:0 c:
* ^TO_Ln
Ln.mbox

# P == personal e-mail address
:0:
* ^TO_P
$DEFAULT

:0
* LASTFOLDER ?? .
{ HOST = _done_processing_ }

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