in reply to email parsing problem?
You are parsing data incorrectly (try long lines or lines starting with "--" to get a bunch of email-control characters.
Use Mail::Message to get attachments out of the email and manipulate mime types better.
use Mail::Message; my $fromline = <STDIN>; my $msg = Mail::Message->read(\*STDIN); if($msg->isMultipart) { for($msg->body->parts) { open(my $tofile,">/tmp/filename") or die "Error opening tmpfile: $!"; $_->print($tofile); close $tofile; # print } }
As you might guess, multiple attachments are also handled correctly.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: email parsing problem?
by Octavian (Monk) on Dec 10, 2003 at 20:35 UTC | |
by shockme (Chaplain) on Dec 11, 2003 at 00:32 UTC |