--- 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
