1 2 3 4 5 6 7 8 9 10 11 12 13
#!/usr/bin/perl -w use MIME::Parser; use strict; use utf8; ########################################### ### Mail parsen ### ########################################### # Create a new MIME parser: my $parser = new MIME::Parser; # Create and set the output directory: $parser->output_dir("/tmp/workdir"); # Read the MIME message: my $entity = $parser->read(\*STDIN) or die "couldn't parse MIME stream";
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
#!/usr/bin/perl use strict; use warnings; BEGIN { # find own workdir; only for test! use FindBin qw<$Bin>; } use MIME::Parser; my $parser = new MIME::Parser; $parser->output_dir("$Bin"); $parser->decode_headers(1); my $entity = $parser->read(\*DATA) or die "couldn't parse MIME stream"; __DATA__ Date: Wed, 28 Dec 2016 10:53:45 +0100 From: GwenDragon <spam@gwendragon.de> Message-ID: <1756562639.20161228105345@gwendragon.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----------04D1960FE3E3E8716" ------------04D1960FE3E3E8716 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit TEST ------------04D1960FE3E3E8716 Content-Type: text/plain; name="=?windows-1252?Q?=E4=F6=FC=DF=80=2Etxt?=" Content-transfer-encoding: base64 Content-Disposition: attachment; filename="=?windows-1252?Q?=E4=F6=FC=DF=80=2Etxt?=" xNbc34A= ------------04D1960FE3E3E8716--