[ python-Bugs-1349106 ] email.Generators does not separates headers with "\r\n"

SourceForge.net noreply at sourceforge.net
Wed Jan 18 00:47:15 CET 2006


Bugs item #1349106, was opened at 2005-11-05 11:50
Message generated for change (Comment added) made by bwarsaw
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1349106&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: None
Status: Closed
Resolution: Wont Fix
Priority: 5
Submitted By: Manlio Perillo (manlioperillo)
Assigned to: Barry A. Warsaw (bwarsaw)
Summary: email.Generators does not separates headers with "\r\n"

Initial Comment:
Regards.

The email.Generator module does not separates headers
with "\r\n".


Manlio Perillo

----------------------------------------------------------------------

>Comment By: Barry A. Warsaw (bwarsaw)
Date: 2006-01-17 18:47

Message:
Logged In: YES 
user_id=12800

I hear what you're saying, but so far, it has been more
convenient for developers when the generator outputs native
line endings.  I can see a case for a flag or other switch
on the Generator instance to force RFC 2822 line endings.

I would suggest joining the email-sig and posting a request
there so the issue can be discussed as an RFE.

----------------------------------------------------------------------

Comment By: Manlio Perillo (manlioperillo)
Date: 2006-01-17 11:26

Message:
Logged In: YES 
user_id=1054957

I do not agree here (but I'm not an expert).

First - the documentation says:
"""The email package attempts to be as RFC-compliant as
possible, supporting in addition to RFC 2822, such
MIME-related RFCs as RFC 2045, RFC 2046, RFC 2047, and RFC 2231.
"""

But, as I can see, the generated email does not conform to
RFC 2822.

Second - I use email package as a "filter".
read raw email text, do some processing, generate raw email
text.

Really, I don't understand why generated headers don't are
separed by '\r\n' and one must rely on an external tool for
the right conversion.

Thanks.

----------------------------------------------------------------------

Comment By: Barry A. Warsaw (bwarsaw)
Date: 2006-01-17 07:54

Message:
Logged In: YES 
user_id=12800

The module that speaks the wire protocol should do the
conversion.  IMO, there's no other way to guarantee that
you're RFC compliant.  You could be getting your data from
the email package, but you could be getting it from anywhere
else, and /that/ source may not be RFC line ended either. 
Since you can't change every possible source of data for
NNTP or SMTP, your network interface must guarantee conformance.

----------------------------------------------------------------------

Comment By: Manlio Perillo (manlioperillo)
Date: 2006-01-17 04:20

Message:
Logged In: YES 
user_id=1054957

Ok, thanks.
But what if I don't use the smtplib module?

I discovered the bug because I have written a small NNTP
server with twisted, using email module for parsing...


----------------------------------------------------------------------

Comment By: Barry A. Warsaw (bwarsaw)
Date: 2006-01-17 00:35

Message:
Logged In: YES 
user_id=12800

Correct; this is by design.  If you're worried about
protocols such as RFC 2821 requiring \r\n line endings,
don't. The smtplib module automatically ensures proper line
endings for the on-the-wire communication.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1349106&group_id=5470


More information about the Python-bugs-list mailing list