You know I have a perl module to do this on CPAN, right?
Doh! _Always_ check CPAN first... ;-)
The ultimate plan after the next release is for me to integrate my perl mail parser, which will give us access to the body parts.
What I've always wanted was a fast parser library (probably an XS interface to a C library) which implemented the full BNF for both RFC-2822 and RFC-1341 (and any subsidiary extensions in wide usage). It seems like everyone writes their own parser; this may be due to the reality that those RFC's are not a complete definition (that's my impression anyways). Or at least take something like the best of both ripmime and reformime's code and create a single library to do the mechanical parsing, and then overlay that with a Perl OO-ish interface to make it easy to examine the content without having to know anything about the physical message itself.
For example:
my $msg = SuperMail::Parser($file, CLEANUP => 1);
next unless $msg->multipart;
foreach my $part ( $msg->body_parts() ) {
next if $part->type("text/*");
$dspam->scan($part->file);
# if virus found, DECLINE or add header
}and have the attached file(s) be extracted at the moment requested, and the temporary files deleted when the $msg object goes out of scope. Does your mail parser do anything like this???
But I have no plans to start doing that until Ask stamps a release out.
Ask, can we get a release now? Pretty please?
John
