curl-library
SMTP authentication fails
Date: Tue, 23 Nov 2010 16:08:38 +0200
Hi,
I am trying to use libcurl version curl-7.21.2 to send email, I tried
two scenarios 1-to use a mail that do not require SSL and useing my
gmail
in case of the first trial my code looks like below
curl_easy_setopt(curl, CURLOPT_URL, "smtp://" SMTPSERVER SMTPPORT);
curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_NONE);
curl_easy_setopt(curl, CURLOPT_USERNAME, USERNAME);
curl_easy_setopt(curl, CURLOPT_PASSWORD, PASSWORD);
curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback);
curl_easy_setopt(curl, CURLOPT_MAIL_FROM, MAILFROM);
curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, rcpt_list);
curl_easy_setopt(curl, CURLOPT_READDATA, &pooh);
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
curl_multi_add_handle(mcurl, curl);
but the output in the console is
* 0x3b65a0 is at send pipe head!
* About to connect() to smtp.netfirms.com port 587 (#0)
* Trying 67.23.128.58... * Connected to smtp.netfirms.com (67.23.128.58) port
587 (#0)
< 220 mx-relay.netfirms.com ESMTP
> EHLO HOMEPC
< 250-mx-relay.netfirms.com
< 250-AUTH LOGIN CRAM-MD5 PLAIN
< 250-AUTH=LOGIN CRAM-MD5 PLAIN
< 250-PIPELINING
< 250 8BITMIME
> AUTH CRAM-MD5
< 334 PDMxMTU0LjEyOTA1MjA3ODdAYmxhaD4=
> YW1yLm9yZWFiYUBtb2thbG1hdC5jb20gYTUxMGE3YjUyMDRkNTNiMmMzZjFiNTQxOTg0OGM2ZDc=
< 535 authorization failed (#5.7.0)
* Authentication failed: 535
> QUIT
< 221 mx-relay.netfirms.com
* Closing connection #0
in case of gmail i use the following code
curl_easy_setopt(curl, CURLOPT_URL, "smtp://" SMTPSERVER SMTPPORT);
curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_NONE);
curl_easy_setopt(curl, CURLOPT_USERNAME, USERNAME);
curl_easy_setopt(curl, CURLOPT_PASSWORD, PASSWORD);
curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback);
curl_easy_setopt(curl, CURLOPT_MAIL_FROM, MAILFROM);
curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, rcpt_list);
curl_easy_setopt(curl, CURLOPT_READDATA, &pooh);
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_ALL);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER,0);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_easy_setopt(curl, CURLOPT_SSLVERSION, 0);
curl_easy_setopt(curl, CURLOPT_SSL_SESSIONID_CACHE, 0);
curl_multi_add_handle(mcurl, curl);
and the output is as below
* 0x3b65a0 is at send pipe head!
* About to connect() to smtp.gmail.com port 587 (#0)
* Trying 209.85.227.109... * Connected to smtp.gmail.com (209.85.227.109) port
587 (#0)
< 220 mx.google.com ESMTP w29sm2875500weq.43
> EHLO HOMEPC
< 250-mx.google.com at your service, [41.206.155.199]
< 250-SIZE 35651584
< 250-8BITMIME
< 250-STARTTLS
< 250 ENHANCEDSTATUSCODES
> STARTTLS
< 220 2.0.0 Ready to start TLS
> QUIT
what is wrong in both cases, i am assuming the first case has a
problem with MD5 and PLAIN authentication but I do not understand what
is wrong with gmail?
I am using the smtp-multi.c example code with the options as above.
Thanks in advance for help.
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-11-23