cURL / Mailing Lists / curl-library / Single Mail

curl-library

issue using SMTP with libcurl

From: Harshdeep Singh <harshcalsoft_at_gmail.com>
Date: Thu, 26 Aug 2010 10:07:46 +0530

Hi,
   I am using SMTP with libcurl to send out mail. What i wanted to know is
there some way we can attach a file to the mail using libcurl.
   The code looks like this:

        curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
         curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_ALL);
         curl_easy_setopt(curl,CURLOPT_READDATA, fd);
         curl_easy_setopt(curl,CURLOPT_URL,"smtp://smtp.gmail.com");
         curl_easy_setopt(curl,CURLOPT_MAIL_FROM, "<harshcalsoft_at_gmail.com
>");
         rcpt = curl_slist_append(rcpt,"<debukhra_at_gmail.com>");
         curl_easy_setopt(curl,CURLOPT_MAIL_RCPT, rcpt);
         rcpt = curl_slist_append(rcpt,"<harshnitc_at_gmail.com>");
         curl_easy_setopt(curl,CURLOPT_MAIL_RCPT, rcpt);
         rcpt = curl_slist_append(rcpt,"<priyakss_at_gmail.com>");
         curl_easy_setopt(curl,CURLOPT_MAIL_RCPT, rcpt);
         rcpt = curl_slist_append(rcpt,"<yuvarajan07_at_gmail.com>");
         curl_easy_setopt(curl,CURLOPT_MAIL_RCPT, rcpt);
         curl_easy_setopt(curl,CURLOPT_USERNAME, username);
         curl_easy_setopt(curl,CURLOPT_PASSWORD, password);

         res = curl_easy_perform (curl);
         printf("The return code is %d\n",res);
         curl_slist_free_all (rcpt);
         curl_easy_cleanup (curl);

Thanks in advance.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-08-26