Well, it seems I fixed my own problem... The problem was corrected by taking the array out of the equation and just sending the $message_txt to the factory objects (I also made config changes to the params for the $spamtest object, but didn't get it working until taking out the array references (@array = split(...)) from the code below.
It seems odd that it would only mess up on the real mail, but it's fixed now so I won't worry about such trivialities. :) Thanks for the continuing great work on the Module, Rulesets, and last but not least, documentation. Steven -----Original Message----- From: Steven Manross Sent: Monday, March 28, 2005 9:13 AM To: [EMAIL PROTECTED] Subject: SA 3.02 rewrite_mail problem I'm having issues rewriting mail. In the case that spam has been found, the message rewrites fine. In the case of real mail, I want the SA headers inserted, but it seems that if I rewrite_mail on non-spam, the message loses all headers (except SA headers) and improperly formats the message text (HTML becomes text, with visible HTML tags). I must say that I am very impressed with the status of 3.02 and am hoping this is a config problem on my end, but can't seem to find my own answer in my searches for it. Upgrading from 2.60 was relatively painless and it looks to handle the message parts better. This code was working on 2.60 (with changes based on version differences). The workaround for now is NOT to change the $message_text with rewrite_mail for non-spam, as doing so will make a messs of the mail. GTUBE seem fine, and the nonspam (after) seems hosed. Any help would be appreciated. (example below) I have added the "add_header all" config line in the local.cf for each of the headers I want in each message. Code snippet follows. SA 3.02 ActivePerl 5.8 (Build 811) W2K SP4 Exchange Server 2000 (all available SPs and Hotfixes) my $spamtest = new Mail::SpamAssassin ({ userprefs_filename => 'X:/spam/assassin/prefs/user_prefs', local_tests_only => 1, username => 'someuser' }); if (is_message_spam($message_text,$spamtest,$mailobj,$statusobj)) { #do stuff } else { #do other stuff } exit 1; sub is_message_spam { my $message_txt = $_[0]; my $spamtest = $_[1]; my @array = split(/\n/,$message_txt); my $mail = $spamtest->parse([EMAIL PROTECTED],1); my $status = $spamtest->check($mail); $mail = $status->get_message(); $_[2] = $mail; $_[3] = $status; #$message_txt = $status->rewrite_mail(); #$_[0] = $message_txt; if ($status->is_spam()) { $message_txt = $status->rewrite_mail(); $_[0] = $message_txt; return 1; } else { return 0; } } NON-SPAM AFTER -------------- X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on homeexch2.manross.net X-Spam-Level: X-Spam-Status: No, score=0.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_60 autolearn=no version=3.0.2 This is a multi-part message in MIME format. --Message-Boundary-19990614 Content-Type: text/plain; charset="US-ASCII" Content-Description: Mail message body Content-Transfer-Encoding: 7bit This is a message from Perl with an attachment. --Message-Boundary-19990614 Content-Type: text/plain; type=Unknown; name="boot.ini" Content-Description: boot.ini Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment [boot loader]timeout=3D30default=3Dmulti(0)disk(0)rdisk(0)partition(1)\WINN T[o perating systems]multi(0)disk(0)rdisk(0)partition(1)\WINNT=3D"My System" --Message-Boundary-19990614-- NONSPAM BEFORE -- HEADERS ------------------------- thread-index: AcUy9fmcNHhQyjavTVKbUKvxBooZ4g== Received: from localhost ([x.x.x.x]) by xxxxxxxx.xxxxxxx.xxx with Microsoft SMTPSVC(5.0.2195.6713); Sun, 27 Mar 2005 10:53:57 -0700 Content-Transfer-Encoding: 7bit To: <[EMAIL PROTECTED]> Content-Class: urn:content-classes:message Importance: normal Priority: normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1478 From: "ME" <[EMAIL PROTECTED]> X-Mailer: Perl+Mail::Sender 0.7.08 by Jan Krynicky Subject: Perl Mail with Attachment test MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Message-Boundary-19990614" Return-Path: <[EMAIL PROTECTED]> Message-ID: <[EMAIL PROTECTED]> X-OriginalArrivalTime: 27 Mar 2005 17:53:57.0443 (UTC) FILETIME=[F2F4C130:01C532F5] Date: 27 Mar 2005 10:53:57 -0700