Here's a CVS patch which fixes the problem of the spam report being added 
before the first MIME part.


Index: lib/Mail/SpamAssassin/PerMsgStatus.pm
===================================================================
RCS file: 
/cvsroot/spamassassin/spamassassin/lib/Mail/SpamAssassin/PerMsgStatus.pm,v
retrieving revision 1.75
diff -u -3 -p -r1.75 PerMsgStatus.pm
--- lib/Mail/SpamAssassin/PerMsgStatus.pm       21 Feb 2002 21:15:03 -0000    
 1.75
+++ lib/Mail/SpamAssassin/PerMsgStatus.pm       3 Mar 2002 08:50:26 -0000
@@ -400,8 +400,27 @@ sub rewrite_as_spam {
       $rep =~ s/=/=3D/gs;               # quote the = chars
     }
 
-    unshift (@{$lines}, split (/$/, $rep));
-    $lines->[0] =~ s/\n//;
+    if ($self->{msg}->get_header ('Content-Type') =~ /boundary="(.*)"/) {
+      # Deal with MIME "null block".  If this is a multipart MIME mail,
+      # peel off the MIME header for the main part of the message,
+      # stick in the report, then put the MIME header back in front,
+      # so that the report is *after* the MIME header.
+      my $boundary = "--$1";
+      my @main_part = ();
+
+      push(@main_part, shift(@{$lines})) while ($lines->[0] !~ /^$boundary/);
+      push(@main_part, shift(@{$lines})) while ($lines->[0] !~ /^$/);
+      push(@main_part, shift(@{$lines}));
+
+      unshift (@{$lines}, split (/$/, $rep));
+      $lines->[0] =~ s/\n//;
+      unshift (@{$lines}, @main_part);
+    }
+    else {
+      unshift (@{$lines}, split (/$/, $rep));
+      $lines->[0] =~ s/\n//;
+    }
+
     $self->{msg}->replace_body ($lines);
   }




-- 
Visit http://dmoz.org, the world's   | Give a man a match, and he'll be warm
largest human edited web directory.  | for a minute, but set him on fire, and
                                     | he'll be warm for the rest of his life.
[EMAIL PROTECTED]  ICQ: 132152059 |


_______________________________________________
Spamassassin-talk mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/spamassassin-talk

Reply via email to