Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

How to make MIME::Parser store emails in .txt files

by pankaj_it09 (Scribe)
on May 12, 2014 at 03:05 UTC ( [id://1085740]=perlquestion: print w/replies, xml ) Need Help??

pankaj_it09 has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks,

The below code outputs the emails in .txt and .html format.
Sometimes the same email is output in both the formats.
How to output in .txt format only ?
my $data = $imap->get_rfc822_body($msg); ### Create a new parser object: my $parser = new MIME::Parser; ### Tell it where to put things: $parser->output_under("I:/test"); ### Parse an in-core MIME message: my $entity = $parser->parse_data($data);

Replies are listed 'Best First'.
Re: How to make MIME::Parser store emails in .txt files
by wjw (Priest) on May 12, 2014 at 03:28 UTC
    Take a look at the last post on Extracting TEXT from email...actually, the whole node is sort of interesting. Goes a long way back, but you may find what you are looking for there at the end...

    Hope that is helpful...

    Update:

    Actaully, reading through Email:MIME it looks like you could do something with debug_structure and/or body_str. I have no experience with this, but it looks promising.

    ...the majority is always wrong, and always the last to know about it...
    Insanity: Doing the same thing over and over again and expecting different results...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1085740]
Approved by kevbot
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (5)
As of 2024-03-29 00:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found