Decoding MIME email

Thomas Williams tom_williams_2000_ca at yahoo.ca
Tue Aug 26 15:03:57 EDT 2003


Thanks, I tried it and it stop at:
f = file("mail.txt")
with the error message. 

TypeError: 'str' object is not callable


Tom Williams


-------- Original Message --------
Subject: Re: Decoding MIME email.
Date: Tue, 26 Aug 2003 01:40:07 +0200
From: Gerhard Häring <gh at ghaering.de>
To: python-list at python.org
References:
<20030825175038.48958.qmail at web13503.mail.yahoo.com>



Thomas Williams wrote:
 	 	Hello everyone, my name is Tom W. And, I am new to
the
list, and have been using Python for about a year now.
Anyway, I got a question! I am trying to decode MIME
(base64) email from a POP3 server, but all I get is a
corrupt file. [...]

You should be using the email module for this. Here
are a few interactive commands that could get you
started:

 	 	
 	 	
 	 	from email.Parser import Parser
f = file("/tmp/mail.txt")
parser = Parser()
msg = parser.parse(f)
f.close()
msg
<email.Message.Message instance at 0x8195e34>

You probably can figure out the rest with the
documentation for the email module, otherwise just ask
here.

Oh, and if your Python doesn't have an email module,
it's really time to upgrade :)

-- Gerhard

-- 
http://mail.python.org/mailman/listinfo/python-list 





More information about the Python-list mailing list