cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: SMTP functionality with authentication fails!

From: Chandran, Naveen <naveen.chandran_at_hp.com>
Date: Mon, 3 Dec 2012 20:59:13 +0000

Hi Steve, Daniel,

>> Please note: with the CURLOPT_HTTPPROXYTUNNEL option still in place, I
>> am able to succeed with the curl_easy_perform anyway (and even send a
>> mail), for the case where I do not use the gmail or other external mail servers.
>>
>> However, when I connect to an external mail server (such as gmail), I
>> get the following logs:
>>
>> * About to connect() to smtp.gmail.com port 465 (#0)

> This looks wrong as libcurl here tries to connect to the remote host and it seems you want to use a proxy. You're supposed to have entered a proxy as well, as CURLOPT_HTTPPROXYTUNNEL only changes how it uses > the specified (HTTP) proxy. You need to provide the proxy name and port separately.

>> * Trying 173.194.68.108... * Connection refused
> ... clearly you can't connect directly to these hosts on port 465. Nothing libcurl can do much about!

Thanks for your patience. Per your suggestion, I modified my code to include the proxy URL and port values explicitly.
Post those (and a few other) changes (I've attached the code for your reference), I get the following error logs:

* About to connect() to proxy web-proxy.cup.hp.com port 8080 (#0)
* Trying 16.216.235.20... * connected
* Connected to xxxxxxxxxx (xx.xxx.xxx.xx) port 8080 (#0)
* Establish HTTP proxy tunnel to smtp.gmail.com:587
* Server auth using Basic with user 'xxx_at_gmail.com'
> CONNECT smtp.gmail.com:587 HTTP/1.1
Host: smtp.gmail.com:587
Proxy-Connection: Keep-Alive

< HTTP/1.1 200 Connection established
<
* Proxy replied OK to CONNECT request
< 220 mx.google.com ESMTP u15sm12534619anq.14
> EHLO xxxx.yyy.zzz.com
< 250-mx.google.com at your service, [15.211.201.85]
< 250-SIZE 35882577
< 250-8BITMIME
< 250-STARTTLS
< 250-ENHANCEDSTATUSCODES
< 250 PIPELINING
* No known auth mechanisms supported!
> QUIT
< 221 2.0.0 closing connection u15sm12534619anq.14
* Closing connection #0
* Login denied

Again, w.r.t the above, kindly note:
1) I am using curl v7.28.1 to verify my test case.
2) I tried including the saved 'gmail server certificate location' in the code (and passed it to CURLOPT_CAINFO).
3) I am using perfectly valid gmail username/password credentials.
4) I have added the CURLOPT_USE_SSL option (with value CURLUSESSL_ALL), since a few archived libcurl solutions indicated the inclusion of this option as having solved the auth issue
     (but the issue persists for mine nevertheless).

Kindly let me know if you might still find anything amiss.

Thanks,
Naveen

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html

Received on 2012-12-03