Note that there are some explanatory texts on larger screens.

plurals
  1. POReading emails from gmail POP3 account using libCurl
    primarykey
    data
    text
    <p>I'm currently working in a C++ project which has to be able to read emails from an gmail POP3 account just like the title says. Also is important to say that I need to download the attachments (is encode base64?) of the mail and its body. The fact is that everyone recommend to use libCurl for this task, but the code sample on their web is not working. I saw this example on <a href="http://curl.haxx.se/libcurl/c/pop3s.html" rel="nofollow noreferrer">Libcurl website</a>:</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;curl/curl.h&gt; int main(void) { CURL *curl; CURLcode res; curl = curl_easy_init(); if(curl) { /* Set username and password */ curl_easy_setopt(curl, CURLOPT_USERPWD, "user:password"); /* This will only fetch the message with ID "1" of the given mailbox */ curl_easy_setopt(curl, CURLOPT_URL, "pop3s://user@pop.example.com/1"); /* Perform the request, res will get the return code */ 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 0; } </code></pre> <p>As you see, the code looks pretty easy for fetching email by email inside the inbox, but when i try to perform the operation with <strong>CURLcode curl_easy_perform(CURL *)</strong> the function doesn't return anything and the process 'dies' so i can't skip this line. My code is the following one:</p> <pre><code>void MailServer::Open(char *username,char *password) { m_username = username; //username = example@gmail.com m_password = password; //password = blabla123 curl = curl_easy_init(); curl_easy_setopt(curl,CURLOPT_USERNAME,username); curl_easy_setopt(curl,CURLOPT_PASSWORD,password); m_popsAccount = "pop3s://" + m_username +"/1"; curl_easy_setopt(curl, CURLOPT_URL, m_popsAccount.c_str()); res = curl_easy_perform(curl); //here does not return anything } </code></pre> <p>I tried to find some 'clear' example on the web, but i really couldn't... Someone could give me a hand with it? :)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload