* Herb Martin wrote (28/07/2005 06:21):
[...]
> 
> After writing the following and trying 
> Mail::SpamAssassin::Message (off and on all afternoon)
> I stumbled upon the tool intended for the job:
> 
> MIME::Parser from MIME::Toolkit (which was already on
> my system) -- the pod doc examples had almost exactly
> what I need (added one line to first example):
> 
> <http://www.globedomain.com/cgi-bin/perldiver/perldiver.cgi?action=2010&modu
> le=MIME%3A%3AParser>
> 
> This does it -- the whole thing -- if I don't mind 
> submitting one file per run (with a command script
> loop for all of them of course):
> 
> #!/usr/bin/perl -w
> 
> use MIME::Parser;
> 
> my $parser = new MIME::Parser;       # Create parser
> $parser->output_dir("./tmp");        # Give output dir
> $parser->extract_nested_messages(0); # Extract messages whole?    
> $entity = $parser->parse(\*STDIN);   # Parse an input filehandle  
> print "Entity: $entity\n\n" if $entity;
> 
> __END__
> 

I use a similar thing. Sorry for not posting about it earlier - I
thought you had a better solution with Mail::SpamAssassin::Message.
One thing to watch out for if any Thunderbird users want to use it:
Thunderbird's attachments will be extracted with spaces in the filenames
(because the filenames are the message subjects) and sa-learn doesn't
handle them well. I use this to fix it:
http://www.tenacious.us/projects/code/nospace.pl

--
Chris

Reply via email to