cURL / Mailing Lists / curl-library / Single Mail

curl-library

[PATCH] smtp.c: Fixed an issue with writing postdata

From: Steve Holme <steve_holme_at_hotmail.com>
Date: Mon, 20 Feb 2012 15:41:01 +0000

Hi Daniel,

Following on from my email on Friday, I have found the other issue I was
having when trying to send multiple emails over SMTP using the same
connection.

It turns out that Curl_write() in smtp_done() was periodically returning
CURLE_OK but with zero in the bytes_written variable. This typically
occurred after sending the data for my first or second email which meant
that the second or third email would then fail as the previous one had not
been terminated correctly.

As such, my initial instinct was to use Curl_pp_sendf() instead as this
deals with this type of situation, however, this function appends a CRLF
when sending data, which we don't want to do when it comes to the EOB as
that already contains the CRLF necessary for committing the message to the
server. In the end I took a look at how Curl_pp_sendf () deals with this
problem and implemented a similar fix in smtp_done().

As such, please find attached an appropriate patch.

Kind Regards

Steve

Received on 2012-02-20