cURL / Mailing Lists / curl-library / Single Mail


RE: Curl using STARTTLS even if mailserver does not support it?

From: Steve Holme <>
Date: Wed, 20 Feb 2013 15:12:26 +0000

Hi Volker,

On Wed, 20 Feb 2013, Volker Schmid wrote:

> I initiate it using curl_easy_setopt with CURLOPT_USE_SSL
> = CURLUSESSL_TRY. I assume that it should use STARTTLS
> only if the mailserver replies to support it. But this
> happens at some customer:

Curl currently sends the STARTTLS command regardless of whether the server
supports it or not.

However, I have recently added support for honouring the STARTTLS capability
which as of the next release curl will only send STARTTLS if the server
advertises it in the EHLO response.

> I can not see any reason why CURL should use STARTTLS
> and obviously it fails. But should CURL not use standard
> AUTH-LOGIN in this case?

As you are using CURLUSESSL_TRY I would have expected you to receive the 554
error, as you did, and then curl should have continued with AUTH-LOGIN if
username and password information was supplied.

> 2013-02-20 14:36:14 : CURL: MAIL FROM:<>
> 2013-02-20 14:36:14 : CURL: Recv failure: Connection was aborted
> 2013-02-20 14:36:14 : CURL: Send failure: Connection was aborted
> 2013-02-20 14:36:14 : CURL: Closing connection #0

From the log you supplied it looks like the username and password wasn't
supplied, so curl treated the connection as anonymous, continued with the
MAIL FROM command and then failed as it couldn't receive a response to that

Does this happen all the time and if so are you able to debug it?

Kind Regards


List admin:
Received on 2013-02-20