MIME-tools

Perl modules for parsing (and creating!) MIME entities
Download

MIME-tools Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • David O'Neill
  • Publisher web site:
  • http://search.cpan.org/~doneill/

MIME-tools Tags


MIME-tools Description

Perl modules for parsing (and creating!) MIME entities MIME-tools is a collection of Perl5 MIME:: modules for decoding, parsing, and generating single- or multipart (even nested multipart) MIME messages.SYNOPSISHere's some pretty basic code for parsing a MIME message, and outputting its decoded components to a given directory: use MIME::Parser; ### Create parser, and set some parsing options: my $parser = new MIME::Parser; $parser->output_under("$ENV{HOME}/mimemail"); ### Parse input: $entity = $parser->parse(*STDIN) or die "parse failed "; ### Take a look at the top-level entity (and any parts it has): $entity->dump_skeleton;Here's some code which composes and sends a MIME message containing three parts: a text file, an attached GIF, and some more text: use MIME::Entity; ### Create the top-level, and set up the mail headers: $top = MIME::Entity->build(Type =>"multipart/mixed", From => "me@myhost.com", To => "you@yourhost.com", Subject => "Hello, nurse!"); ### Part #1: a simple text document: $top->attach(Path=>"./testin/short.txt"); ### Part #2: a GIF file: $top->attach(Path => "./docs/mime-sm.gif", Type => "image/gif", Encoding => "base64"); ### Part #3: some literal text: $top->attach(Data=>$message); ### Send it: open MAIL, "| /usr/lib/sendmail -t -oi -oem" or die "open: $!"; $top->print(*MAIL); close MAIL;For more examples, look at the scripts in the examples directory of the MIME-tools distribution. Requirements: · Perl


MIME-tools Related Software