Philip Prindeville wrote:
> Could we add an example of using envelope info?
SpamAssassin doesn't see the envelope. Some MTAs add headers for
envelope-header and envelope-recipients (Return-Path:, X-Apparently-To:, etc.)
If you're careful about how you call SpamAssassin you can fake envelope rules
using these headers.
For example MIMEDefang adds the following headers prior to calling SpamAssassin:
Return-Path: (envelope-sender)
Received: (sendmail-style)
Apparently-To: (envelope-recipients)
(in mimedefang.pl, sub spam_assassin_mail)
# Synthesize a "Return-Path" and "Received:" header
my @sahdrs;
push (@sahdrs, "Return-Path: $Sender\n");
push (@sahdrs, split(/^/m, synthesize_received_header()));
push (@sahdrs, gen_msgid_header()) if ($MessageID eq "NOQUEUE");
# Add To: header if one missing
if (open(IN, "<./HEADERS")) {
my $hto = grep { /^To:/i } <IN>;
close(IN);
push(@sahdrs, "To: undisclosed-recipients:;\n") unless $hto;
}
if ($AddApparentlyToForSpamAssassin and
($#Recipients >= 0)) {
push(@sahdrs, "Apparently-To: " .
join(", ", @Recipients) . "\n");
}
unshift (@msg, @sahdrs);
my $sa_ver = Mail::SpamAssassin->VERSION();
# Only keep major version number
$sa_ver =~ s/\..*//;
if ($sa_ver >= 3) {
if (!defined($SASpamTester)) {
my $object = spam_assassin_init(@_);
return undef unless $object;
}
return $SASpamTester->parse([EMAIL PROTECTED]);
} else {
return Mail::SpamAssassin::NoMailAudit->new(data=>[EMAIL PROTECTED]);
}
--
Matthew.van.Eerde (at) hbinc.com 805.964.4554 x902
Hispanic Business Inc./HireDiversity.com Software Engineer