As discussed in "Header check and script" thread, I modified the yammer sub in Client.pm (yes, I'm sure it's not very pretty; my Perl skills are very rusty.. but it seems to work). It doesn't yet check for the end of the header (i.e. for a blank line) to prevent replacement in the body as well, but I did both the addition of "X-Spam: yes" header and cleanup of the Subject line in the content filter. My question is, does this violate any RFCs? The resultant header includes the "X-Spam: yes" in between of Delivered-To and From lines, like so:
------ Delivered-To: [EMAIL PROTECTED] X-Spam: yes <------------ this was added From: Some User <[EMAIL PROTECTED]> To: Ville Walveranta <[EMAIL PROTECTED]> Subject: This is spam! <------------ "**SPAM**" was removed Date: Mon, 28 Jul 2008 09:58:26 +0000 (UTC) ------ I'd rather do both in the content filter as down the line there are likely other change actions that needs to be done, and thus the single action that can be done with header_checks isn't very useful. Here's the modified yammer sub: ------[begin excerpt from smtpprox MSDW/SMTP/Client.pm]------ sub yammer { my ($self, $fh) = (@_); my $spamheader = "X-Spam: yes\r\n"; my $spam = 0; local (*_); local ($/) = "\r\n"; while (<$fh>) { if ($_ =~ m/^Subject:\s*\*\*SPAM\*\*\s+/i) { $spam = 1; } } seek( $fh, 0, 0); if ($spam == 1) { $self->{sock}->print($spamheader) or die "$0: write error: $!\n"; } while (<$fh>) { s/^\./../; if ($spam == 1) { s/^Subject:\s*\*\*SPAM\*\*\s+/Subject: /i; } $self->{sock}->print($_) or die "$0: write error: $!\n"; } $self->{sock}->print(".\r\n") or die "$0: write error: $!\n"; } ------[end excerpt from smtpprox MSDW/SMTP/Client.pm]------