Movatterモバイル変換


[0]ホーム

URL:


API Overview
Docs
API: easyAPI: multiAPI: shareAPI: URLAPI: WebSocketEnvironment varsErrorsExamplesSecuritySymbolsTutorial
easy setopt optionseasy getinfo optionsmulti setopt optionsTLS options
Functions
All functionscurl_easy_getinfocurl_easy_initcurl_easy_performcurl_easy_resetcurl_easy_setoptcurl_multi_add_handlecurl_multi_initcurl_multi_performcurl_multi_remove_handlecurl_multi_setopt
curl /libcurl /API /Examples /smtp-ssl.c

smtp-ssl.c

Related:
All functions
File a bug
Symbols
View in git
View raw
  ###  ###  *payload_text = TO_MAIL FROM_MAIL CC_MAIL upload_status {  size_t bytes_read;};  size_t( *ptr, size_t size, size_t nmemb, *userp){ upload_status *upload_ctx = ( upload_status *)userp; *data;  size_t room = size * nmemb; ((size == 0) || (nmemb == 0) || ((size*nmemb) < 1)) { 0;  }   data = &payload_text[upload_ctx->bytes_read]; (data) {    size_t len = strlen(data);(room < len)      len = room;    memcpy(ptr, data, len);    upload_ctx->bytes_read += len;  len;  }  0;} (){  CURL *curl;  CURLcode res = CURLE_OK; curl_slist *recipients = NULL; upload_status upload_ctx = { 0 };   curl =curl_easy_init();(curl) {curl_easy_setopt(curl,CURLOPT_USERNAME,);curl_easy_setopt(curl,CURLOPT_PASSWORD,); curl_easy_setopt(curl,CURLOPT_URL,); #curl_easy_setopt(curl,CURLOPT_SSL_VERIFYPEER, 0L);# #curl_easy_setopt(curl,CURLOPT_SSL_VERIFYHOST, 0L);# curl_easy_setopt(curl,CURLOPT_MAIL_FROM, FROM_MAIL);     recipients =curl_slist_append(recipients, TO_MAIL);    recipients =curl_slist_append(recipients, CC_MAIL);curl_easy_setopt(curl,CURLOPT_MAIL_RCPT, recipients); curl_easy_setopt(curl,CURLOPT_READFUNCTION, payload_source);curl_easy_setopt(curl,CURLOPT_READDATA, &upload_ctx);curl_easy_setopt(curl,CURLOPT_UPLOAD, 1L); curl_easy_setopt(curl,CURLOPT_VERBOSE, 1L);     res =curl_easy_perform(curl); (res != CURLE_OK)      fprintf(stderr,,curl_easy_strerror(res)); curl_slist_free_all(recipients); curl_easy_cleanup(curl);  }  ()res;}

Notice

This source code example issimplified and ignores returncodes and error checks to a large extent. We do this to highlight the libcurlfunction calls and related options and reduce unrelated code.

A real-world application will of course properly check every return value andexit correctly at the first serious error.


[8]ページ先頭

©2009-2025 Movatter.jp