New submission from dandre <andr...@gmx.net>:

Hello there, first of all, thank you all for Python. I didn't know it was so 
great; otherwise I'd have checked it out before.

Using 2.7.2 MSC v.1500 32 Intel bit for now.

Playing with email.header, I came across an odd behaviour.

Attached please find a script which demonstrates that
1) maxlinelen is ignored and
2) header fields are split in a manner not suitable for all systems involved in 
email processing.

The script will print the headers. They're all the same and extend over two 
lines; both should probably not be the case, although it dosn't hurt in itself.

If you uncomment the SMTP part of the script and send that email to yourself, 
you'll probably see that the From: and To: header will be misinterpreted by 
your email client; I tested this with two different email providers. Looking at 
the raw data which are received, it appears that at least in one case, a system 
along the way added a comma between the two "To:" lines. This is something 
which one should easily be able to avoid, if only the maxlinelen would be 
obeyed...

Having taken a look at email.header.py, it appears to me that the semantics of 
_encode_chunks() does not exactly match its documentation due to the results of 
(at least some) charset.header_encode() calls. What seems to happen is that 
charset.header_encode() can return several lines already, and it will 
apparently split the line without any deeper knowledge. As a result, the Header 
module will not apply its sophisticated maxlinelen/splitchars logic. The header 
is split at some pretty arbitrary point and not all systems appear to be happy 
with that, although the relevant RFC apparently only reads "SHOULD" in this 
regard.

----------
components: Library (Lib)
files: email_header_bug.py
messages: 141290
nosy: dandre
priority: normal
severity: normal
status: open
title: email.Header corupts international email header and ignores maxlinelen 
in some cases
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file22783/email_header_bug.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12649>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to