Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #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, "ime.prezime@gmail.com");
- curl_easy_setopt(curl, CURLOPT_PASSWORD, "Sifra");
- /*Otvaranje mejla za funkcije koje koriste imap*/
- //curl_easy_setopt(curl, CURLOPT_URL, "imaps://imap.gmail.com:993/INBOX/");
- /*Čitanje određenog mejla (u ovom slučaju 2) preko imap protokola*/
- //curl_easy_setopt(curl, CURLOPT_URL, "imaps://imap.gmail.com:993/INBOX/;MAILINDEX=2");
- /*Čitanje (ili otvaranje ako se koristi još neka funkcija) određenog mejla (u ovom slučaju 4) preko pop3 protokola*/
- //curl_easy_setopt(curl, CURLOPT_URL, "pop3s://pop.gmail.com:995/4");
- /*Preusmeravanje primljenih podataka u fajl*/
- //FILE* fajl = fopen("outuput.txt", "w");
- //curl_easy_setopt(curl, CURLOPT_WRITEDATA, fajl);
- /*Uključivanje debuggera (ispisuje procese kojie se trenutno odvijaju) - nebitno*/
- //curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
- /*Brisanje određenog mejla preko pop3 protokola*/
- //curl_easy_setopt(curl, CURLOPT_NOBODY, 1L);
- //curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "DELE");
- /*Pretraga mejlova preko imap protokola, za više search komandi: https://tools.ietf.org/html/rfc3501#section-6.4.4 */
- //curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "SEARCH TEXT <jebise>");
- //curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "SEARCH UNSEEN");
- /* 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;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement