> From:  Russell Nelson <[EMAIL PROTECTED]>
> Date:  23 Dec 1998 05:22:07 -0000
>
> Marcos writes:
>  > Thanks.  I am using pine in a mail server running sendmail, I use
>  > to: and cc: the same person, that is me. When I check the mail box,
>  > I get one email only. I believe sendmail know that the mail is
>  > going to the same person.
> 
> It's guessing.  Not only is it guessing, but it guesses poorly.  What
> if you CC'ed an alias for yourself on a different machine?
> 
>  > So, it simply send me one copy only.
>  > However, in qmail. I created a .qmail file at my directory with
>  > content nothing. I use pine and send abc a mail with cc to himself
>  > also. The result is abc got two identical mails. Can anyone tell me
>  > how to make the qmail sends me one email instead of two.
> 
> http://www.qmail.org/index.html#eliminate-dups

Two problems Russ.

1) That URL doesn't get you to "eliminate-dups" since index.html is the page 
that gives you a list of mirrors.

2) A minor bin in eliminate-dups:  you have to create the .older file by hand.

Attached, you'll find the version of your script that I'm currently using.

Chris


#!/usr/local/bin/perl

$hashname = shift;

use MD5;
$md5 = new MD5;

$loose = 0;                     # loose matching if set.

while(<>) {
    last if /^$/;
    next if $ignore_continue && /^\s/;
    $ignore_continue = 0;
    if (/^(received|delivered-to):/i) {
        $ignore_continue = 1;
        next;
    }
    if (!$loose) {
        $headers .= $_;
        next;
    }
    if ($keep_continue && /^\s/) {
        $headers .= $_;
        next;
    }
    $keep_continue = 0;
    if (m/^(from|message-id|date):/i) {
        $headers .= $_;
        $keep_continue = 1;
        next;
    }
    next;
}

$md5->add($headers);
$md5->addfile(STDIN);
$hash = $md5->hexdigest;
print "Our hash:$hash\n";

if (open(HASH, "<$hashname.newer")) {
    flock(HASH, 2);
    while(<HASH>) { chomp; if ($_ eq $hash) {print "In newer file\n"; exit 99}}
    close(HASH);
}
if (open(HASH, "<$hashname.older")) {
    flock(HASH, 2);
    while(<HASH>) { chomp; if ($_ eq $hash) {print "In older file\n"; exit 99}}
    close(HASH);
} 
    
# roll the files once a week.
if (-M "$hashname.older" > 7) {
        rename("$hashname.newer", "$hashname.older") || die "$0: Unable to move newer 
to older";
}

# add the hash to the "received messages" list.
open(HASH, ">>$hashname.newer") || die "$0: Cannot append to $hashname.newer";
print HASH "$hash\n";
close(HASH);

print "Original message\n";
exit 0;
Chris Garrigues                 Deep Eddy Internet Consulting
+1 512 432 4046                 609 Deep Eddy Avenue                    O-
http://www.DeepEddy.Com/~cwg/   Austin, TX  78703-4513

  My email address is an experiment in SPAM elimination.  For an
  explanation of what we're doing, see http://www.DeepEddy.Com/tms.html 

    Nobody ever got fired for buying Microsoft,
      but they could get fired for relying on Microsoft.

PGP signature

Reply via email to