Jeff,

 :}PS. Why did you need to use x-mailing-list? It's a good idea, of
 :}course, but I'm curious: Did the automated sorting heuristics fail?
 :}

The heuristics apparently did fail.  Not only that, the 
procmail trick mentioned in the FAQ failed as well, using
version 3.11-pre7.

SMTP is easy.  Sendmail is a bit trickier.  I found a clue
in the doublebounce.pl script in the sendmail distribution.
You might try bouncing messages with the attached perl
script (this has been very lightly tested).

Thanks,

Michael
[EMAIL PROTECTED]


#!/usr/bin/perl -w
#
#  Bounce mailing list messages with X-mailing-list and 
#    X-archive-with-date headers added.
#

#  Site-specific variables

$sendmail = "/usr/bin/sendmail";
$delimiter = "^From ";

if ($#ARGV < 2) {
    &Usage();
    exit -1;
}

$destination = shift;
$listname = shift;

BOX:
foreach $mailfile (@ARGV) {
    open (MAILBOX, "$mailfile") 
        or next BOX;
    print "$0: Opening $mailfile\n";
    $leadingjunk = 1;
    $msgsent = 0;
LINE:
    while (<MAILBOX>) {
        if ($leadingjunk && !/$delimiter/) {
            next LINE;
        }
        elsif (/$delimiter/) {
            $leadingjunk = 0;
            # close old pipe if open
            close MAIL;
            # idea taken from doublebounce.pl 
            # in the contrib directory of the sendmail 8.9.1 distribution.
            # -ocn:  expensive delivery agents okay
            # -odi:  delivery mode "interactive".  errors handled by the program.
            # -oeq:  quiet error handling
            open(MAIL, "| $sendmail -ocn -odi -oeq $destination")
                or die "$0: Could not open pipe to $sendmail. $!\n";
            # don't print the line with the delimiter
            $msgsent++;
        }
        elsif (/^Date: (.*)/) {
            print MAIL $_;
            print MAIL "X-mailing-list: $listname\n";
            print MAIL "X-archive-with-date: $1\n";
        }
        else { print MAIL $_; }
    }
    close MAIL;
    print "$0: $msgsent messages sent to $destination\n";
}
        
sub Usage {
    print <<EOM;
#-------------------------------------------------------#
Usage: $0 <destination> <list_address> <mail_file>...        
#-------------------------------------------------------#
$0 is used to bounce mailing list messages to a 
new address with all of the original headers intact.   
<destination> is the address to which you will bounce the messages.
<list_address> is the mailing address of the list.

The header lines
    X-mailing-list: <list_address>
    X-archive-with-date: original_date
will be added to the message. 

The original date is identical to the Date header.  
The messages are taken from mail files taken on the command line.
#-------------------------------------------------------#

EOM
}

Reply via email to