On Saturday 02 March 2002 09:37 pm, I wrote: > rawbody ONLY_ATTACHMENTS eval:check_for_only_attachments() > describe ONLY_ATTACHMNETS Only attachmnets, no text
Ooops, spelling mistake in "describe". Should be describe ONLY_ATTACHMENTS Only attachmnets, no text > sub check_for_only_attachments { Ughh, that was ugly. Here's a much better one: sub check_for_only_attachments { my ($self, $body) = @_; my $ctype = $self->{msg}->get_header ('Content-Type'); $ctype ||= ''; my $multipart_boundary; if ($ctype =~ /boundary="(.*)"/) { $multipart_boundary = "--$1"; } else { # Not a multipart, no attachments return 0; } my $i = 0; $i++ while($body->[$i] !~ /^$multipart_boundary/); $i++ while($body->[$i] !~ /^$/); # OK, now we're in the body of the first MIME part, where the # non-attachment message goes. If we find a non-blank line before # the next MIME part, then there's something besides an attachment # in this mail for (; $i < @$body; $i++) { return 1 if ($body->[$i] =~ /^$multipart_boundary/); return 0 if ($body->[$i] !~ /^$/); } # Should we ever even get here? return 0; } -- Visit http://dmoz.org, the world's | Give a man a match, and he'll be warm largest human edited web directory. | for a minute, but set him on fire, and | he'll be warm for the rest of his life. [EMAIL PROTECTED] ICQ: 132152059 | _______________________________________________ Spamassassin-talk mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/spamassassin-talk