#!/usr/bin/perl -w use strict; use Email::MIME; use Net::POP3; #my $file = 'Beispielnachricht.txt'; #my $file = 'multipart.txt'; #my $message = do { local( @ARGV, $/ ) = $file; <> }; my $host = 'pop.Xserver.de'; my $user = 'user@Xserver.de'; my $pw = 'tollespw'; my $pop = Net::POP3->new($host) || die("Kein Kontakt zu $host. $!"); my $anzahl = $pop->login($user, $pw); my $message = $pop->get($anzahl); #print "@$message\n"; if(my $parsed = Email::MIME->new(@$message)){ my $absender = $parsed->header('From'); my $subject = $parsed->header('Subject'); my @parts = $parsed->parts; my $parts = $parsed->parts; print "Absender: $absender\n"; print "Betreff: $subject\n"; print "Parts: $parts\n"; for my $part (@parts){ if(scalar @{$part->{'parts'}} > 0){ for my $part (@{$part->{'parts'}}){ #next if($part->content_type =~ m/text\/html/); my $text .= $part->body; print "Text: $text\n"; } } } }