Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
You're part-way there with MIME::Parser, but you're not actually using the return value of ->parse() for some reason. Try something like this as a starting point:

my $entity = $parser->parse( IO::File->new( "$dir/raw-message.$i") ); foreach my $part ($entity->parts()) { # Look at $part (a MIME::Entity object) and determine what to do +with it }

MIME::Parser::parse() will return a top-level MIME::Entity object for the message. If it's a multipart message, you can get the separate MIME::Entity objects for each subpart by iterating over $entity->parts().

Then in that foreach loop, you can examine the content-type or filename of each part and determine what you want to do with it.

In reply to Re: Saving attachments from email files by dave0
in thread Saving attachments from email files by inblosam

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2021-05-17 10:23 GMT
Find Nodes?
    Voting Booth?
    Perl 7 will be out ...

    Results (154 votes). Check out past polls.