]> granicus.if.org Git - curl/commitdiff
examples: Updated SMTP examples to set CURLOPT_UPLOAD
authorSteve Holme <steve_holme@hotmail.com>
Tue, 31 Dec 2013 00:19:10 +0000 (00:19 +0000)
committerSteve Holme <steve_holme@hotmail.com>
Tue, 31 Dec 2013 00:19:10 +0000 (00:19 +0000)
docs/examples/simplesmtp.c
docs/examples/smtp-multi.c
docs/examples/smtp-tls.c

index df85162424347e692d10cd0436b650ea6e0ad63a..8ce87808c40cc164a14ca307ec0798ae45cb1983 100644 (file)
@@ -62,6 +62,7 @@ int main(void)
      * as a FILE pointer) as shown here.
      */
     curl_easy_setopt(curl, CURLOPT_READDATA, stdin);
+    curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
 
     /* send the message (including headers) */
     res = curl_easy_perform(curl);
index 6462aff2d54b5c238930979b2290a5a5b1a6ba69..145c7a26071a581418bc100393e7dd0f16d31ff0 100644 (file)
@@ -120,6 +120,7 @@ int main(void)
    curl_easy_setopt(curl, CURLOPT_USERNAME, USERNAME);
    curl_easy_setopt(curl, CURLOPT_PASSWORD, PASSWORD);
    curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback);
+   curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
    curl_easy_setopt(curl, CURLOPT_MAIL_FROM, MAILFROM);
    curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, rcpt_list);
    curl_easy_setopt(curl, CURLOPT_USE_SSL, (long)CURLUSESSL_ALL);
index 3635c103f2608a457f7271d3b93e98806732bb7a..7c969764e68c683b14b85416a8fbedb05b806739 100644 (file)
@@ -82,7 +82,7 @@ int main(void)
   upload_ctx.lines_read = 0;
 
   curl = curl_easy_init();
-  if (curl) {
+  if(curl) {
     /* This is the URL for your mailserver. Note the use of port 587 here,
      * instead of the normal SMTP port (25). Port 587 is commonly used for
      * secure mail submission (see RFC4403), but you should use whatever
@@ -118,6 +118,7 @@ int main(void)
 
     /* value for envelope reverse-path */
     curl_easy_setopt(curl, CURLOPT_MAIL_FROM, FROM);
+
     /* Add two recipients, in this particular case they correspond to the
      * To: and Cc: addressees in the header, but they could be any kind of
      * recipient. */
@@ -131,6 +132,7 @@ int main(void)
      */
     curl_easy_setopt(curl, CURLOPT_READFUNCTION, payload_source);
     curl_easy_setopt(curl, CURLOPT_READDATA, &upload_ctx);
+    curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
 
     /* Since the traffic will be encrypted, it is very useful to turn on debug
      * information within libcurl to see what is happening during the transfer.