Google Answers Logo
View Question
 
Q: Perl / MIME ( No Answer,   1 Comment )
Question  
Subject: Perl / MIME
Category: Computers > Programming
Asked by: cgersch-ga
List Price: $15.00
Posted: 21 May 2004 13:32 PDT
Expires: 20 Jun 2004 13:32 PDT
Question ID: 350084
I need to parse with Perl (module: MIME::Parser) an MIME encoded
E-Mail message (saved in a variable). How can I extract the plaintext
only and save it in a variable?
Answer  
There is no answer at this time.

Comments  
Subject: Re: Perl / MIME
From: nandigam-ga on 30 May 2004 23:21 PDT
 
Hi cgersch,

May be this will help you.

#!/usr/local/bin/perl

use MIME::Parser;

my $parser = new MIME::Parser;
$entity = $parser->parse_open("mail.msg");
$body = $entity->bodyhandle;
$string = $body->as_string;
print $string."\n";

The mail.msg file contained:
*****************************************************************
From MAILER-DAEMON Tue Apr 20 19:46:39 2004
Date: 20 Apr 2004 19:46:39 -0400
From: Mail System Internal Data <MAILER-DAEMON@cs.odu.edu>
Subject: DON'T DELETE THIS MESSAGE -- FOLDER INTERNAL DATA
Message-ID: <1082504799@cs.odu.edu>
X-IMAP: 1080886419 0000000003
Status: RO

This text is part of the internal format of your mail folder, and is not
a real message.  It is created automatically by the mail system software.
If deleted, important folder data will be lost, and it will be re-created
with the data reset to initial values.


***************************************************************

If this doesnt work out let me know.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy