[Mimedefang] action_add_header before SpamAssassin
Michael Faurot
mfaurot at atww.org
Sun Mar 14 00:34:04 EST 2004
In article <Pine.LNX.4.58.0403132137010.3552 at shishi.roaringpenguin.com> you wrote:
>> I realize it would be possible to make adjustments to $hits, after
>> calling spam_assassin_check() and then incrementing or decrementing as
>> appropriate based upon my SPF query. However, I'd prefer to keep this
>> within SA so that any adjustments made based upon SPF get logged in SA's
>> report and are listed as tests run by SA.
> You will have to examine mimedefang.pl and modify the way the message is
> handed off the SA to do this.
Upon your suggestion, I did some looking around within mimedefang.pl and
the various spam_assassin_* routines. The following, done in
filter_begin() and before calling spam_assassin_check(), seems to give me
the desired result:
# This will put the header into the message that actually gets
# received.
action_add_header("Received-SPF", $spf_header);
# To have SA actually look at this header and do something with it
# we have to put it into INPUTMSG ourselves.
if (open (MAIL, "<./INPUTMSG")) {
my $mail = new Mail::Internet \*MAIL;
close (MAIL);
my $head = $mail->head();
$head->add("Received-SPF", "$spf_header");
if (open (MAIL, ">./INPUTMSG")) {
$mail->print(\*MAIL);
close (MAIL);
}
}
As I discovered from experimentation, if I only do my routine, the
Received-SPF header doesn't show up in the message that ultimately gets
delivered. So I have to do both my routine and call
action_add_header().
Thanks for the help!
More information about the MIMEDefang
mailing list