RE: SpamAssassin integration missing Received: headers
"Carlos Perez" <[email protected]> Mon, 14 Jun 2004 12:50:19 -0600
| Newsgroups | gmane.comp.lang.perl.modules.mail-box,gmane.spam.detected |
|---|---|
| Message-ID | <[email protected]> |
Mark,
Thank you for your quick response.
I got my code working by hacking Wrapper/SpamAssassin.pm. Rather than
returning a scalar context, I changed the code to return an array context.
The Received: headers are an array of Field objects and don't get
'flattened' correctly. (at least for me).
Here is my change. I can send you my SpamAssassin testcase if that helps.
diff -ru /usr/lib/perl5/site_perl/5.8.0/Mail/Message/Wrapper/SpamAssassin.pm
SpamAssassin.pm
--- /usr/lib/perl5/site_perl/5.8.0/Mail/Message/Wrapper/SpamAssassin.pm
2004-05-16 07:43:16.000000000 -0600
+++ SpamAssassin.pm 2004-06-14 12:39:45.000000000 -0600
@@ -32,8 +32,17 @@
sub get_header($)
{ my ($self, $name) = @_;
- my $field = $self->get_mail_object->head->get($name);
- defined $field ? $field->unfoldedBody : undef;
+ my $header;
+ # Use array context, not scalar.
+ my @fields = $self->get_mail_object->head->get($name);
+ if (@fields) {
+ my @lines;
+ foreach my $field (@fields) {
+ push(@lines, $field->unfoldedBody);
+ }
+ $header = join("\n", @lines);
+ }
+ return $header;
}
#------------------------------------------
> Although I understand your question, it is too hard to "debug" this
> from a distance. If you know what is wrong, you may be able to
> give me some hints. But I expect you have to pass some arguments to
> Mail::SpamAssassin->new(...)
> See the docs of that module. If you figured-out what the problem is,
> please tell me and I will adapt the docs.
> --
> MarkOv
>
> ------------------------------------------------------------------------
> drs Mark A.C.J. Overmeer MARKOV Solutions
> [email protected] [email protected]
> http://Mark.Overmeer.net http://solutions.overmeer.net
>