Skip to content

Instantly share code, notes, and snippets.

@ericychoi
Last active January 15, 2016 18:56
Show Gist options
  • Save ericychoi/f35a19519d5e24ca8869 to your computer and use it in GitHub Desktop.
Save ericychoi/f35a19519d5e24ca8869 to your computer and use it in GitHub Desktop.
SImple MIME Parser from STDIN
#!/opt/perl/bin/perl
use MIME::Parser;
use strict;
use warnings;
my $parser = MIME::Parser->new();
$parser->output_to_core(1);
$parser->decode_bodies(1);
my $entity = $parser->parse(\*STDIN);
$entity->print_header();
print "\n";
for my $part ($entity->parts()) {
print $part->bodyhandle()->as_string();
print "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment