[Mimedefang] Patch: adding custom headers for SpamAssassin

Jonas Eckerman jonas at fsdb.org
Fri Sep 22 10:51:55 EDT 2006


Hi!

I posted this before, but never got any response. Not sure if that was because my idea was bad or uninteresting or because noone noticed it. :-)

It's just a simple way (a global array) to add headers to the temprary message created for SpamAssassin, so that these headers may be included in rules and in the bayes automagic. The change to mimedefang.pl is small.

Personaly I'd like to see it in the official version, so that I don't have to remember to patch it when upgrading. :-)

Regards
/Jonas
-- 
Jonas Eckerman, FSDB
http://www.fsdb.org/
-------------- next part --------------
--- mimedefang.pl	Fri May 12 15:58:29 2006
+++ mimedefang.pl.new	Fri May 12 15:48:48 2006
@@ -58,7 +58,8 @@
 	    $AddApparentlyToForSpamAssassin $WarningCounter
 	    @VirusScannerMessageRoutines @VirusScannerEntityRoutines
 	    $VirusScannerRoutinesInitialized $MDOpenLogCalled
-	    %SendmailMacros %RecipientMailers $CachedTimezone);
+	    %SendmailMacros %RecipientMailers $CachedTimezone
+	    @SpamAssassinHeaders);
 
 use vars qw($GeneralWarning);
 use vars qw($HTMLFoundEndBody $HTMLBoilerplate $SASpamTester);
@@ -5472,6 +5473,7 @@
     undef @StatusTags;
     undef @ESMTPArgs;
     undef @SenderESMTPArgs;
+    undef @SpamAssassinHeaders;
 }
 
 sub builtin_create_parser () {
@@ -5602,6 +5604,9 @@
 	}
     }
 
+    # Setup empty spamassassin header list
+    @SpamAssassinHeaders = ();
+
     # Call pre-scan filter if defined
     if (defined(&filter_begin)) {
 	push_status_tag("In filter_begin");
@@ -6478,6 +6483,7 @@
 	push(@sahdrs, "Apparently-To: " .
 	     join(", ", @Recipients) . "\n");
     }
+    unshift (@msg, @SpamAssassinHeaders);
     unshift (@msg, @sahdrs);
     my $sa_ver = Mail::SpamAssassin->VERSION();
     # Only keep major version number


More information about the MIMEDefang mailing list