473,406 Members | 2,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Decoding MIME email

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@ghaering.de>
To: py*********@python.org
References:
<20************************@web13503.mail.yahoo.co m>

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

Jul 18 '05 #1
1 3723
Thomas Williams <to******************@yahoo.ca> wrote:

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

TypeError: 'str' object is not callable


I'll wager you have a line something like this before that:

file = sys.argv[0]
....
f = file("mail.txt")

Either do not use variables called "file", or replace the "file" with
"open" in your function call.
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Thomas Williams | last post by:
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...
2
by: Bjorn Jensen | last post by:
Hello! My resulting image har nearly same size of original (but not exact) and the nu.jpg can be shown, but it is modified so much, that it look totally different.... why? what to do? Greetings...
27
by: gRizwan | last post by:
Hello all, We have a problem on a webpage. That page is sent some email data in base64 format. what we need to do is, decode the base64 data back to original shape and extract attached image...
0
by: john s | last post by:
Hi, I was wondering if it is possible to decode a MIME email message using built-in .net methods? I have a .eml file produced by IIS' SMTP server, and I would like to divide and decode the parts...
25
by: marcin.rzeznicki | last post by:
Hello everyone I've got a little problem with choosing the best decoding strategy for some nasty problem. I have to deal with very large files wich contain text encoded with various encodings....
0
by: mubx2000 | last post by:
Hi , I'm looking for code (Symbian C++) that can do the following things: 1-Analyzing the (MIME) types (Content-typemContent-transfere-encoding,Mime Version,Conent Description). 2-Download...
3
by: b. dougherty | last post by:
Greetings all- I am trying to extract subject headers from emails that have been saved as text files. The subject headers are in MIME UTF-8 format, and so they appear like this: subject:...
2
by: pmz | last post by:
Dear Group, I've got a problem with decoding e-mail message subject, which has been read within usage of Pear_Mail_Mime library. There are some elements unwelcome in my subject string, such...
0
by: shilpab | last post by:
My query is regarding the decoding classes available in Exchange 2007. I am working on a problem where I want to decode a TNEF encoded MIME message. I am using the class Base64Decode in...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.