Index: lib/Mail/SpamAssassin.pm =================================================================== RCS file: /cvsroot/spamassassin/spamassassin/lib/Mail/SpamAssassin.pm,v retrieving revision 1.174 diff -u -r1.174 SpamAssassin.pm --- lib/Mail/SpamAssassin.pm +++ lib/Mail/SpamAssassin.pm @@ -778,7 +778,9 @@ if ( $msg[$i] =~ /^\s*$/ ) { # end of mime header # Ok, we found the encapsulated piece ... - if ( $ct eq "message/rfc822" && $cd eq $self->{'encapsulated_content_description'} ) + if ($ct =~ m@(?:message/rfc822|text/plain);\s+x-spam-type=original@ || + ($ct eq "message/rfc822" && + $cd eq $self->{'encapsulated_content_description'})) { splice @msg, 1, $i; ; # remove the front part, leave the 'From ' header. @@ -805,7 +807,7 @@ # Ok, we're in the mime header ... Capture the appropriate headers... $flag = 1; - if ( $msg[$i] =~ /^Content-Type:\s+(\S+)/i ) { + if ( $msg[$i] =~ /^Content-Type:\s+(.+?)\s*$/i ) { $ct = $1; } elsif ( $msg[$i] =~ /^Content-Description:\s+(.+?)\s*$/i ) { Index: lib/Mail/SpamAssassin/Conf.pm =================================================================== RCS file: /cvsroot/spamassassin/spamassassin/lib/Mail/SpamAssassin/Conf.pm,v retrieving revision 1.171.2.3 diff -u -r1.171.2.3 Conf.pm --- lib/Mail/SpamAssassin/Conf.pm +++ lib/Mail/SpamAssassin/Conf.pm @@ -643,13 +643,20 @@ $self->{subject_tag} = $1; next; } -=item report_safe { 0 | 1 } (default: 1) +=item report_safe { 0 | 1 | 2 } (default: 1) if this option is set to 1, if an incoming message is tagged as spam, instead of modifying the original message, SpamAssassin will create a new report message and attach the original message as a message/rfc822 MIME part (ensuring the original message is completely preserved, not easily opened, and easier to recover). + +If this option is set to 2, then original messages will be attached with +a content type of text/plain instead of message/rfc822. This setting +may be required for safety reasons on certain broken mail clients that +automatically load attachments without any action by the user. This +setting may also make it somewhat more difficult to extract or view the +original message. If this option is set to 0, incoming spam is only modified by adding some headers and no changes will be made to the body. Index: lib/Mail/SpamAssassin/PerMsgStatus.pm =================================================================== RCS file: /cvsroot/spamassassin/spamassassin/lib/Mail/SpamAssassin/PerMsgStatus.pm,v retrieving revision 1.282.2.2 diff -u -r1.282.2.2 PerMsgStatus.pm --- lib/Mail/SpamAssassin/PerMsgStatus.pm +++ lib/Mail/SpamAssassin/PerMsgStatus.pm @@ -654,7 +654,15 @@ $disposition = "inline"; } + my $type = "message/rfc822"; + $type = "text/plain" if $self->{conf}->{report_safe} > 1; + my $description = $self->{main}->{'encapsulated_content_description'}; + + # Note: the message should end in blank line since mbox format wants + # blank line at end and messages may be concatenated! In addition, the + # x-spam-type parameter is fixed since we will use it later to recognize + # original messages that can be extracted. $newmsg .= <<"EOM"; MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="$boundary" @@ -669,13 +677,14 @@ $report --$boundary -Content-Type: message/rfc822 +Content-Type: $type; x-spam-type=original Content-Description: $description Content-Disposition: $disposition Content-Transfer-Encoding: 8bit $original --$boundary-- + EOM my @lines = split (/^/m, $newmsg);