ietf-smtp
[Top] [All Lists]

Re: DATA Pipelining

2009-12-26 11:49:06



Steve Atkins wrote:
On Dec 25, 2009, at 10:46 PM, Sabahattin Gucukoglu wrote:

Hi all,

Just writing a minimal implementation of SMTP here to serve a very specific 
need, that of gatewaying news articles, and have wondered how to handle the 
DATA phase with regard to pipelined text.  As I see it, there is no reason not 
to pipeline both the message text lines and the final dot, because nothing is 
expected from the server and until the dot is received there is no change of 
state other than the accumulation of the DATA buffer.  But I also know there 
are implementations out there which don't like it when a command is incomplete, 
and try to respond to whatever is in their TCP buffer, and wondered if anybody 
knew how that might work for the final dot if it were stuffed at the end of 
some text.

Is there any specific guidance anywhere on this?  I tried RFC 2920 already.  I 
really don't want to send each individual line as a single send, and I'm pretty 
sure that's not necessary or even common.  I do know sendmail saves its final 
dot for a final send, though.

You should be fine sending the entire payload as-is.

(Writing and testing a robust SMTP submission client is tedious, though, 
especially when you find you need to handle authentication. Pretty much every 
language has solid SMTP libraries available for it, so unless you have some 
unusual requirements you should take a look at libesmtp or Email::Send or 
whatever the common way of doing SMTP in your language of choice is).

If you haven't already chosen the language, I highly recommend Python. Python makes it easy to write scripts that handle complex operations, even if you are not expert in the underlying protocols. It has a huge library of modules for SMTP, DNS, TCP, MIME, whatever you need. See http://docs.python.org/3.1/library/

I might use smtplib, for example, if I need to send some data to another machine that is already running an SMTP server. This allows you to work at the application level (helo, mail, rcpt, data, quit). The data function appends an ending dot, so you don't have to worry about that detail.

If you need to control things at a lower level, there is a socket module that provides a low-level network interface (TCP commands, etc.). There is also an email module that takes care of formatting and RFC compliance issues.

-- Dave

<Prev in Thread] Current Thread [Next in Thread>