Hi,
        no it's not in plain .txt format. it's in Microsoft's outlook message
(.msg) format.
        I tired the following code, but it's not working

        ******************
          import email.Parser
        fp = open('mymail.msg', 'rb')
        p = email.Parser.Parser()
        msg = p.parse(fp)  ---- > error
        fp.close()
         ******************

Error are:

  File "/usr/lib/python2.2/email/Parser.py", line 62, in parse
self._parseheaders(root, fp)
  File "/usr/lib/python2.2/email/Parser.py", line 128, in _parseheaders
raise Errors.HeaderParseError(
email.Errors.HeaderParseError: Not a header, not a continuation: ``
����%__substg1.0_0064001E*������������$__substg1.0_0065001E*
����#_substg1.0_0070001E*������������"__substg1.0_00710102*����!__substg1.0_
0C190102*������������I__substg1.0_0C1A001E*����__substg1.0_0C1D0102*��������
����
__substg1.0_0C1E001E*����__substg1.0_0C1F001E*��������_substg1.0_0E1D001E*��
����������__substg1.0_1000001E*����$__substg1.0_1008001E*������������e__subs
tg1.0_10090102*����''
>>> PuTTYPuTTYPuTTY
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
NameError: name 'PuTTYPuTTYPuTTY' is not defined
>>>


Rgds,
Kalpana

-----Original Message-----
From: Barry Warsaw [mailto:[EMAIL PROTECTED]
Sent: Saturday, May 07, 2005 6:32 PM
To: [EMAIL PROTECTED]
Cc: [email protected]
Subject: Re: [Email-SIG] save .msg as .txt


On Sat, 2005-05-07 at 05:54, Kalpana Sinduria wrote:

>       I am new for python. working on Linux, having python 2.2 ver.
>       I have to write a C++ code to convert Microsoft .msg file to plain .txt
> file.
>
>       Is it possible to parse Microsoft .msg  using python's email package and
> save it as .txt file.
>       I am interested only in "from", "CC", "subject", "Date time " and
"message
> body" not in attachment with .msg file.

If it's stored in plain text RFC 2822 format, then sure <wink>.  If not,
then no, email's parse wouldn't be able to handle it.  Is the format
even documented?  I've heard that it's nearly impossible to get the full
plain text message out of some Microsoft tools.

-Barry




http://www.patni.com
World-Wide Partnerships. World-Class Solutions.
_____________________________________________________________________

This e-mail message may contain proprietary, confidential or legally
privileged information for the sole use of the person or entity to
whom this message was originally addressed. Any review, e-transmission
dissemination or other use of or taking of any action in reliance upon
this information by persons or entities other than the intended
recipient is prohibited. If you have received this e-mail in error
kindly delete  this e-mail from your records. If it appears that this
mail has been forwarded to you without proper authority, please notify
us immediately at [EMAIL PROTECTED] and delete this mail. 
_____________________________________________________________________
_______________________________________________
Email-SIG mailing list
[email protected]
Your options: 
http://mail.python.org/mailman/options/email-sig/archive%40mail-archive.com

Reply via email to