[SlugBug] Parsing attachments from emails

David Leadbeater slugbug at dgl.cx
Wed Jun 7 21:03:53 BST 2006


Hi,

Bill Best wrote:
[..]
> i have created a Perl script as suggested thus:
> 
> >use MMS::Mail::Parser;
> >my $mms = MMS::Mail::Parser->new();
> >my $message = $mms->parse(\*STDIN);
> >if (defined($message)) {
> >  my $parsed = $mms->provider_parse;
> >  print $parsed->header_subject."\n";
> >  print $parsed->body_text."\n";
> >} else {
> >  print STDERR "Invalid message\n";
> >}
> 
> which pipes its output to STDOUT.  i have called the script mmsparser.pl 
[..]

Is it an MMS message? That looks like it parses MMS messages to me..

> has anyone any better ideas or suggestions?

MIME tools is the standard perl way to do this (the MMS stuff you've
found is very similar to it), it has some example scripts, this one:
http://search.cpan.org/src/DSKOLL/MIME-tools-5.420/examples/mimeexplode
Looks like the most relevant to what you want to do.

HTH
David


More information about the SlugBug mailing list