473,383 Members | 1,868 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,383 software developers and data experts.

email.get_filename() with newline

Hi,

if I use part.get_filename() with the following email part:

------_=_NextPart_001_01C81B11.52AB8006
Content-Type: application/vnd.ms-excel;
name="=?iso-8859-1?Q?30102007=28aktualisiert=29=5FK=FCndigungen_env iaM=5FErdgas?=
=?iso-8859-1?Q?_S=FCds__GmbH=2Exls?="
Content-Disposition: attachment;
filename="=?iso-8859-1?Q?30102007=28aktualisiert=29=5FK=FCndigungen_env iaM=5FErdgas?=
=?iso-8859-1?Q?_S=FCds__GmbH=2Exls?="
Content-Description: =?iso-8859-1?Q?30102007=28aktualisiert=29=5FK=FCndigungen_env iaM=5FErdgas?=
=?iso-8859-1?Q?_S=FCds__GmbH=2Exls?=
Content-Transfer-Encoding: base64

0M8R4KGxGu...

I get a filename which includes a newline character and the ?iso... encoding
is not resolved. But the mail user agent "mutt" does display the filename
correct. I tried it with the latest email packages (4.0.2).

Any hints how to parse this filename?

Thomas
Nov 9 '07 #1
1 2379
En Fri, 09 Nov 2007 10:46:15 -0300, Thomas Guettler <hv@tbz-pariv.de>
escribi�:
if I use part.get_filename() with the following email part:

------_=_NextPart_001_01C81B11.52AB8006
Content-Type: application/vnd.ms-excel;
name="=?iso-8859-1?Q?30102007=28aktualisiert=29=5FK=FCndigungen_env iaM=5FErdgas?=
=?iso-8859-1?Q?_S=FCds__GmbH=2Exls?="
Content-Disposition: attachment;
filename="=?iso-8859-1?Q?30102007=28aktualisiert=29=5FK=FCndigungen_env iaM=5FErdgas?=
=?iso-8859-1?Q?_S=FCds__GmbH=2Exls?="
Content-Description:
=?iso-8859-1?Q?30102007=28aktualisiert=29=5FK=FCndigungen_env iaM=5FErdgas?=
=?iso-8859-1?Q?_S=FCds__GmbH=2Exls?=
Content-Transfer-Encoding: base64

0M8R4KGxGu...

I get a filename which includes a newline character and the ?iso...
encoding
is not resolved. But the mail user agent "mutt" does display the filename
correct. I tried it with the latest email packages (4.0.2).
According to RFC2047, section 5:

+ An 'encoded-word' MUST NOT appear within a 'quoted-string'.

+ An 'encoded-word' MUST NOT be used in parameter of a MIME
Content-Type or Content-Disposition field, or in any structured
field body except within a 'comment' or 'phrase'.

so the above headers are invalid.
Any hints how to parse this filename?
You may try joining the lines and unfolding them by hand, and perhaps then
you could convince the decode_header function to work in this case...

--
Gabriel Genellina

Nov 12 '07 #2

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

Similar topics

3
by: dont bother | last post by:
Hey, I have been trying to parse emails: But I could not find any examples or snippets of parsing emails in python from the documentation. Google did not help me much too. I am trying to...
2
by: David Stockwell | last post by:
snippet payload = {} try: message = email.message_from_string(message) messageHeader = dict(message._headers) addressFrom = messageHeader addressReply = messageHeader.get("Reply-To")...
4
by: Paul Schmidt | last post by:
Dear list: I am new to python, and I am trying to figure out the short answer on something. I want to open a POP3 mailbox, read the enclosed mail using the POP3 module, , and then process it...
3
by: Joh | last post by:
hello, i'm looking for a way to get total size of an email (with its attached files) using library such as poplib, or ? can someone help me or give me an url from where to start ? thx
11
by: Faheem Mitha | last post by:
Hi, I'm not sure what would be more appropriate, so I'm ccing it to both alt.comp.lang.learn.c-c++ and comp.lang.python, with followup to alt.comp.lang.learn.c-c++. While working with a...
2
by: brettk | last post by:
Hello All, Here's what I'm trying to do: I need to connect to a pop3 server, download all messages, and copy all of the attachments into a specific directory. The actual email message is...
2
by: Jagdip Singh Ajimal | last post by:
I have setup an email notifications system, that basically takes each row from a table and sents out an email according to the data in that row. The emails get sent, with the subject being filled...
7
by: erikcw | last post by:
Hi all, I'm trying to extract zip file (containing an xml file) from an email so I can process it. But I'm running up against some brick walls. I've been googling and reading all afternoon, and...
3
by: Beliavsky | last post by:
I work for a financial company where we run Windows XP and read email using Microsoft Outlook 2003. I get daily files that come as email attachments from various counterparties. I save them as...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.