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

MIMEMultipart() and CRLF vs RFC 2046

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
2 2342
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: McKirahan | last post by:
How would I use a regular expression to remove all trailing Carriage Returns and Line Feeds (%0D%0A) from a textarea's value? Thanks in advance. Also, are they any great references for learning...
5
by: McKirahan | last post by:
I'd like to use regular expressions to remove extraneous Carriage Return Line Feeds (CrLf) from a textarea before the form is submitted. I'd like to remove all trailing CrLf's and convert all...
2
by: Nicolae Fieraru | last post by:
Hi All, I have a table in the database and a Word document saved on the hard disk. I want to mailmerge the content of the table into the word document, all done in vba. Any examples? I...
1
by: Jack Wright | last post by:
Dear All, In a multiline field if I enter the following way: Mangesh Anant Kodilkar There is a carriage return after each word. Now when I press save,it loses the CRLF characters. This is not...
2
by: Michael Persaud | last post by:
Hi All, Im trying to have a few strings presented in a LABEL. However the CRLF is not working. eg str = str1 + crlf + str2 + crlf + str3 label.text= str Do i need to declare the crlf as a...
2
by: AboutJAV | last post by:
Hi, In my code, I accept very long string, which may be greater than 2046 bytes. String can not exceed this limit. What else can I use to store these very long string? Thanks,
0
by: berb.web | last post by:
list - using python's MIMEMultipart() object I've noticed that it interjects a 'MIME-Version' in the interpart header, like so... <snip> --some_MIME_Boundry Content-Type: text/plain;...
6
by: tony.abbitt | last post by:
I have recently installed Office 2007 (SP1) retaining the previous installation of Office 2003. I have converted an Access 2003 database to Access 2007. The database contains the VBA code...
3
by: MLH | last post by:
The following unexpected error occurred in AppSpecific Module's Sub Check4PastSaleDates(), line #350 when called from Cron Form: 2046: "The command or action 'SetWarnings' isn't available now." ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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: 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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.