[Email-SIG] getting Message.as_string() to put CR-LF on end of each line?
Bill Janssen
janssen at parc.com
Fri Mar 9 20:35:50 CET 2007
I'm trying to use the email package (4.x) as the underpinning for an
IMAP server. As part of this, I need to send each line of the message
from the server to the client with a CR-LF attached. My mail is in
files with CR-LF as line separators. I create a Message from
"open(message_path_name, 'rb')". I then call "as_string", and get the
message back with only LF. Looking at the code, I see that the
default header-printing methods in Generator just call "print" (which
strikes me as a bad idea), and get the default newline handling, which
the body-printing calls file.write(), and gets whatever get_payload()
returned, and I don't see why this doesn't preserve CR-LF pairs in the
file.
So: how can Generator.flatten(), or as_string(), be fixed to specify
CR-LF line endings for each line?
Bill
More information about the Email-SIG
mailing list