--- Message.pm.old	2003-12-09 18:04:11.000000000 +0000
+++ Message.pm	2003-12-09 18:09:45.000000000 +0000
@@ -93,6 +93,7 @@
 # $deleted		set by delivery functions
 # $headerspath          set by WriterHeaderFile # file is read-only
 # $cantparse		set by Explode
+# $toomanyattach	set by Explode
 # $entity		set by Explode
 # $tnefentity		set by Explode (only set if it's a TNEF message)
 # $badtnef		set by Explode
@@ -832,8 +833,7 @@
   #      MIME::Entity::MailScannerCounter() . " and max = $maxparts\n";
   #$entity = undef
   #  if $maxparts>0 && MIME::Entity::MailScannerCounter()>=$maxparts;
-  if (!$entity ||
-      ($maxparts>0 && MIME::Entity::MailScannerCounter()>=$maxparts)) {
+  if (!$entity) {
     #print STDERR "Found an error!\n";
     $pipe->close();
     waitpid $pid, 0;
@@ -844,6 +844,17 @@
     $this->{otherinfected} = 1;
     return;
   }
+  # Too many attachments in the message?
+  if ($maxparts>0 && MIME::Entity::MailScannerCounter()>=$maxparts) {
+    #print STDERR "Found an error!\n";
+    $pipe->close();
+    waitpid $pid, 0;
+    MailScanner::Log::WarnLog("Too many attachments in %s", $this->{id});
+    $this->{entity} = $entity; # In case it failed due to too many attachments
+    $this->{toomanyattach} = 1;
+    $this->{otherinfected} = 1;
+    return;
+  }
 
   #close($pipe);
   # Closing the pipe this way will reap the child, apparently!