Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
No such thing as a small change
 
PerlMonks  

Re: Carving up MIME email on STDIN

by markov (Scribe)
on Dec 03, 2003 at 19:31 UTC ( #311984=note: print w/ replies, xml ) Need Help??


in reply to Carving up MIME email on STDIN

Yes, there is little info in the docs -- and I have to maintain that MailTools code :-( -- Anyway, after playing around with it, I decided that the structure chosen is not sufficient for the current complex messages. Have you thought of multi-level multiparts? Anyway: there came MailBox

Example to show that it works easy (although installation has too many dependencies, I know):

 use File::Temp;
 my $dir = tempdir; mkdir $dir or die;
 
 use Mail::Message;
 my $msg = Mail::Message->read(\*STDIN);
 foreach my $part ($msg->parts('RECURSE'))
 {  next if $part->isBinary;
    my $fn  = $message->body->dispositionFilename($dir);

    $message->decoded->write(filename => $fn)
        or die "Couldn't write to $fn: $!\n";
 }

See Mail::Box in HTML. Have a look at rebuild(), which may be able to do for you what you had planned. Just an alternative to MIME::* and MailTools to keep in mind.


Comment on Re: Carving up MIME email on STDIN

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://311984]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2014-04-20 18:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (486 votes), past polls