By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,818 Members | 1,313 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,818 IT Pros & Developers. It's quick & easy.

MIMEMultipart() and CRLF vs RFC 2046

P: n/a
alf
Hi,

according to rfc2046, line breaks in MIME are CRLF. However python just
uses LF like in the following example:
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText

msg = MIMEMultipart()
msg['Subject'] = 'Our family reunion'
msg['From'] = 'a@a.b'
msg['To'] = 'c@x.y'
msg.epilogue = ''

msg.attach(MIMEText('aaaaaaaaaaaaaaaaaaaaaaaa'))

print `msg.as_string()`
gives:
'Content-Type: multipart/mixed;
boundary="===============1018679223=="\nMIME-Version: 1.0\nSubject: Our
family reunion\nFrom: a@a.b\nTo:
c@x.y\n\n--===============1018679223==\nContent-Type: text/plain;
charset="us-ascii"\nMIME-Version: 1.0\nContent-Transfer-Encoding:
7bit\n\naaaaaaaaaaaaaaaaaaaaaaaa\n--===============1018679223==--\n'

Any insight why does it not stick to standard. I also checked parsing
and it seems to accept both CRLF and LF.

--
Thx, alfz1
Oct 5 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
At Thursday 5/10/2006 18:52, alf wrote:
>according to rfc2046, line breaks in MIME are CRLF. However python just
uses LF like in the following example:
The comments inside generator.py say CRLF everywhere, but the code
simply uses print >>f
You should file a bug report at http://sourceforge.net/tracker/?group_id=5470
Gabriel Genellina
Softlab SRL

__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya!
http://www.yahoo.com.ar/respuestas

Oct 6 '06 #2

P: n/a
alf
Gabriel Genellina wrote:
At Thursday 5/10/2006 18:52, alf wrote:
>according to rfc2046, line breaks in MIME are CRLF. However python just
uses LF like in the following example:


The comments inside generator.py say CRLF everywhere, but the code
simply uses print >>f
they also define NL as '\n\ only.
You should file a bug report at
http://sourceforge.net/tracker/?group_id=5470
done

--
alfz1
Oct 6 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.