Here's an improvment to the basic body-scan snippet so it does not attempt to
scan a non-text first/body mime part:
my $bdyscn_flag = 0;
my $part0 = $entity->parts(0);
if (defined $part0) {
my ($type, $subtype) = split('/', $part0->effective_type);
my $bh = $type eq 'text' ? $part0->bodyhandle : undef;
if (defined $bh && (my $bio = $bh->open("r"))) {
while (defined($_ = $bio->getline)) {
chomp;
if (m/MATCH SOME TEXT/) {
$bdyscn_flag = 1; last
}
}
$bio->close;
}
}
if ($bdyscn_flag) {
# do something
}
_______________________________________________
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID. You may ignore it.
Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list [email protected]
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang