I am sending email messages from a PHP script to an Exim 4.71 server via SMTP. The server advertises pipelining so I am trying to take advantage of it. However, when I read back the return codes I finally get 554 SMTP synchronization error
. On the server side the error reads:
SMTP protocol synchronization error (next input sent too soon: pipelining was advertised): rejected "DATA" H=(localhost) [111.111.111.111] next input="To: [email protected]\nDate: Wed, 12 Jun 2013 11:35:50 +1200\nReturn-Path: [email protected]\nSubject: Blablablablabla"
I am wondering why is it saying "next input sent too soon". I am using pipelining and so should be allowed to send my data not waiting for anything.
Note that when I do not use pipelining it all goes fine.
You have to wait for a response to the DATA verb before sending the actual SMTP data. That way if the server rejects the MAIL, RCPT(s), or DATA, you can get out of the transaction before pumping the potentially-large message bodies down the pipe.
Using pipelining doesn't allow to to throw everything down the pipe without caring about it, you still have to check SMTP responses and there are rules about what verbs must be the last in a set that is sent together, etc. The pipelining RFC does a pretty good job explaining it