cURL / Mailing Lists / curl-library / Single Mail

curl-library

SMTP connection ends with HELP command

From: Mariusz Gogulski <mgo_at_in-software.com>
Date: Wed, 28 Jan 2015 15:57:32 +0100

Hello,

Recently I started to learn how to use LibCurl as I want to be able to use it for POP3 and SMTP. With POP3 and POP3S I don't have any problems (listing mails, downloading particular mails). With SMTP(S) on the other hand I have a little bit problem. (Tried it with my own MDaemon server (both ssl and non-ssl connection) and gmail.com (SSL)). Every time I try to send an E-Mail first command sent after authentication is HELP, I get response from MDaemon that it's not supported ( 214 Help system currently inactive ) and from gmail a link to RFC2821 (< 214 2.0.0 http://www.google.com/search?btnI&q=RFC+2821).

After this there is just one line in the log:

Connection #0 to host smtp.gmail.com left intact

and nothing else.

I'm using code from smtp-mail.c and smtp-ssl.c (below). I'm using curl-7.40.0 version.

Could you point me what do I do wrong?

 ccCurlResult = curl_global_init(CURL_GLOBAL_ALL);
 if(ccCurlResult == 0)
 {
  hCurl = curl_easy_init();

  if ( hCurl )
  {
   curl_easy_setopt( hCurl, CURLOPT_USERNAME, login );
   curl_easy_setopt( hCurl, CURLOPT_PASSWORD, pass );
   curl_easy_setopt( hCurl, CURLOPT_HEADER, 1L );
   curl_easy_setopt( hCurl, CURLOPT_VERBOSE, 1L);
   curl_easy_setopt( hCurl, CURLOPT_STDERR, fp ); //fp-handle to opened log file

   curl_easy_setopt(hCurl, CURLOPT_USE_SSL, CURLUSESSL_ALL);
   curl_easy_setopt(hCurl, CURLOPT_SSL_VERIFYPEER, 0);
   curl_easy_setopt(hCurl, CURLOPT_SSL_VERIFYHOST, 0);
   curl_easy_setopt( hCurl, CURLOPT_URL, "smtps://smtp.gmail.com:465");
   recipients = curl_slist_append(recipients, TO);
    
   recipients = curl_slist_append(recipients, CC);
   curl_easy_setopt(hCurl, CURLOPT_MAIL_FROM, FROM);
   curl_easy_setopt(hCurl, CURLOPT_READDATA, &mime); //mime - handle to opened mime
   curl_easy_setopt(hCurl, CURLOPT_UPLOAD, 1L);

   ccCurlResult = curl_easy_perform(hCurl);
   curl_easy_cleanup(hCurl);
  }
  curl_global_cleanup();
 }

Regards
Mariusz Gogulski

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-01-28