Hi all! I am new to libcurl and am trying to download mails from
imap.gmail.com. I am able to download the mail in a console but my problem
is that I am unable to save the mails on a location on my computer as a
file. Please help me. Any help would be appreciated. Here is a sample of my
code.

#include <stdio.h>

#include <curl/curl.h>

int main(void)

{

  CURL *curl;

  CURLcode res = CURLE_OK;


  curl = curl_easy_init();

  if(curl) {

    /* Set username and password */

    curl_easy_setopt(curl, CURLOPT_USERNAME, "username");

    curl_easy_setopt(curl, CURLOPT_PASSWORD, "password");


    curl_easy_setopt(curl, CURLOPT_URL, "imaps://imap.gmail.com/INBOX/;UID=1");

    curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);


    curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);

    curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);


    /* Perform the fetch */

    res = curl_easy_perform(curl);


    /* Check for errors */

    if(res != CURLE_OK)

      fprintf(stderr, "curl_easy_perform() failed: %s\n",

              curl_easy_strerror(res));


    /* Always cleanup */

    curl_easy_cleanup(curl);

  }


  return (int)res;

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

Reply via email to