cURL / Mailing Lists / curl-library / Single Mail


Sending email

From: <>
Date: Wed, 11 Sep 2013 12:19:20 -0700

Hi -

I am trying to use libcurl in a Windows C++/MFC application, to send
email, starting with the example pgm smtp-tls.c.

There is some difficulty with the certificate verification process,
which I am not familiar with, and don't understand.

Any tips on what is wrong, or where to look?

Here is the log produced when CURLOPT_VERBOSE is turned on:
* About to connect() to port 587 (#0)
* Trying
* Connected to ( port 587 (#0)
< 220 ESMTP ready
> EHLO p-new
< 250-SIZE 41697280
< 250-8 BITMIME
< 220 2.0.0 Start TLS
* successfully set certificate verify locations:
* CAfile: none
   CApath: C:/xxx/xxx/xxx/xxx/ATToutbound.pem (this is the complete
path on my local machine)
* SSL certificate problem: unable to get local issuer certificate
* Closing connection 0
curl_easy_perform() failed: Peer certificate cannot be authenticated
with given CA certificates
I produced the file ATToutbound.pem by using openssl to convert a
DER-encoded certificate file. The DER-encoded file was produced by
using the certificate export feature of my email client, Eudora.

Eudora is not connected with the libcurl program I'm writing. I just
copied its settings and used it to get a copy of the certificate.

A possibly-relevant complication is that the certificate presented by
AT&T is no longer considered "trusted" by Eudora, and in order to get
Eudora to send mail, I had to accept the certificate as presented.
With this proviso, Eudora uses the above smtp server to send email
using "secure sockets, alternate port" (Eudora uses port 465).

If I use port 465 with libcurl, I get
* About to connect() to port 465 (#0)
* Trying
* Connected to ( port 465 (#0)
* response reading failed
* Closing connection 0
curl_easy_perform() failed: Failure when receiving data from the peer
32-bit Windows XP, SP3. libcurl 7.29.0.

List admin:
Received on 2013-09-11