[Mimedefang] documentation bug/omission for newbies
starlight.2016q2 at binnacle.cx
starlight.2016q2 at binnacle.cx
Sun Apr 17 17:10:28 EDT 2016
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
}
More information about the MIMEDefang
mailing list