Advertisement
Momir

Mejl slanje hotmail

Feb 26th, 2020
915
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.28 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <curl/curl.h>
  4.  
  5. int main(void)
  6. {
  7.     CURL* curl;
  8.     CURLcode res = CURLE_OK;
  9.  
  10.  
  11.     curl = curl_easy_init();
  12.     if (curl) {
  13.         struct curl_slist* recipients = NULL;
  14.         curl_mime* mime;
  15.         curl_mimepart* part;
  16.         const char** cpp;
  17.  
  18.         curl_easy_setopt(curl, CURLOPT_URL, "smtp://smtp.live.com:587");
  19.         curl_easy_setopt(curl, CURLOPT_USERNAME, "ime.prezime@hotmail.com");
  20.         curl_easy_setopt(curl, CURLOPT_PASSWORD, "Sifra");
  21.         recipients = curl_slist_append(recipients, "ime.prezime@hotmail.com");
  22.         curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients);
  23.         curl_easy_setopt(curl, CURLOPT_USE_SSL, (long)CURLUSESSL_ALL);
  24.         curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
  25.         curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
  26.         mime = curl_mime_init(curl);
  27.         part = curl_mime_addpart(mime);
  28.         curl_mime_filedata(part, "D:\\jebise.txt");
  29.         curl_easy_setopt(curl, CURLOPT_MIMEPOST, mime);
  30.  
  31.         for (long long int i = 15; 1; i++) {
  32.             res = curl_easy_perform(curl);
  33.             Sleep(3000);
  34.  
  35.             if (res != CURLE_OK)
  36.                 fprintf(stderr, "Nije poslato, error: %s\n", curl_easy_strerror(res));
  37.             else
  38.                 fprintf(stderr, "%lld\n", i);
  39.         }
  40.  
  41.         curl_slist_free_all(recipients);
  42.         curl_easy_cleanup(curl);
  43.         curl_mime_free(mime);
  44.     }
  45.  
  46.     return (int)res;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement