[Twisted-Python] "local" semantics soughtin twisted.protocols.smtp.sendmail

Sergio Trejo serj_trejo at hotmail.com
Tue Jul 27 17:22:38 EDT 2004


Glad that I was able to help out. Any guess as to what the original author 
meant by "local"? By using \n to delimit new lines, isn't that essentially 
saying the same thing as the oringal author?

Perhaps of interest, the way I arrived at this nuance in the documentation 
is that a project I'm working on requires a node running an SMTP server to 
receive mail and then parse the contents of each mail message I'm sending 
with my Twisted application. Each line in the body of a mail message I'm 
sending contains API key, value pairs that are parsed by software on the 
node. I originally used the built-in Python smtplib.server.sendmail() 
method, and in order for it to work with the parsing software on the remote 
node, I had to end each line with a carriage return and a line feed as in:


However, what I found different is that the node's parsing software didn't 
like it when I'd send mail as in the above example (with carriage return and 
line feed) via the Twisted SMTP module equivalent. To remedy this, I just 
had to remove the carriage returns, so its no big deal. But I am still 
curious as to why Python's sendmail eats the /r/n and why not with the 
Twisted equivalent. Perhaps just a silly nit pick but perhaps there is a 
deeper logical reasoning to this (I.e., could Twisted be making an 
improvement on the Python smtplib)?

Thanks for any further insight.


>From: Jp Calderone <exarkun at divmod.com>
>Reply-To: Twisted discussion stuff <twisted-python at twistedmatrix.com>
>To: Twisted discussion stuff <twisted-python at twistedmatrix.com>
>Subject: Re: [Twisted-Python] "local" semantics 
>soughtin	twisted.protocols.smtp.sendmail
>Date: Tue, 27 Jul 2004 15:15:31 -0400
>Sergio Trejo wrote:
>>The API documentation for twisted.protocols.smtp.sendmail method states 
>>that the incoming msg parameter ((a string or a file object) must contain 
>>contain lines
>>that end with a line feed character because, verbatim: "Line endings must 
>>local (I.e., '\n')" ... the URL that I'm quoting from is 
>>I am curious what is meant by the word "local" to describe the use of line 
>>endings in the API documentation. Does local mean something specific to an 
>>operating system of which the Python interpreter is compiled for and runs 
>>on top of (and if so, doesn't that break the philosophy of Python which is 
>>mostly OS agnostic)?
>   The documentation is wrong.  Use \n to delimit newlines.  I'll go fix 
>the docs in SVN.  Thanks for pointing this out.
>   Jp

Add photos to your e-mail with MSN 8. Get 2 months FREE*. 

More information about the Twisted-Python mailing list