[Python-Dev] CRLF in email.Generator
Greg Ward
gward@python.net
Fri, 16 Nov 2001 14:24:58 -0500
On 16 November 2001, Gustavo Niemeyer said [regarding the 'email' package]
> I've been looking at the Generator module. It seems to be writing
> the message with:
>
> print >> self._fp, "text"
>
> This should probably be replaced by:
>
> self._fp.write("text"+"\r\n")
This is true if, say, _fp is a socket connected to an SMTP server.
But conventional usage (eg. my ~/Mailbox) dictates that lines end with
"\n" in a Unix filesystem.
Perhaps the Right Answer is:
self._fp.write("text" + nl)
where the value of nl ("\n", "\r\n", "\r", whatever) depends on the
platform and the target of the message (file, SMTP server, whatever).
Greg
--
Greg Ward - programmer-at-large gward@python.net
http://starship.python.net/~gward/
And now for something completely different.