I need your guys ... I'm currently working on a C ++ project that should be able to read emails from a Gmail Gmail account, as the header says. It is also important to say that I need to download attachments (is it encode base64?) Of the mail and its body. The fact is that everyone recommends using libCurl for this task, but the sample code on their Internet does not work. I saw this example on the Libcurl website :
As you can see, the code looks pretty easy to receive email by email inside the Inbox, but when I try to perform a operation with CURLcode curl_easy_perform (CURL *) , the function returns nothing and the process dies, so I can’t miss this line. My code is as follows:
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 }
I tried to find some “clear” example on the Internet, but I really couldn’t ... Can someone give me a hand? :)
source share