From 5d25d626b1a79f9059cdaaffd6b3caa7c3c01ea5 Mon Sep 17 00:00:00 2001 From: Steve Holme Date: Sun, 12 Jan 2014 16:32:48 +0000 Subject: examples: Removed user information and TLS setup from SMTP multi example Simplified the SMTP multi example as this example should demonstrate the differences the easy and multi interfaces rather than introduce new concepts such as user authentication and TLS which are shown in the TLS and SSL examples. --- docs/examples/smtp-multi.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) (limited to 'docs') diff --git a/docs/examples/smtp-multi.c b/docs/examples/smtp-multi.c index 005a15f61..895dd2c15 100644 --- a/docs/examples/smtp-multi.c +++ b/docs/examples/smtp-multi.c @@ -23,17 +23,12 @@ #include /* This is an example showing how to send mail using libcurl's SMTP - * capabilities via the multi interface. + * capabilities. It builds on the smtp-mail.c example to demonstrate how to use + * libcurl's multi interface. * * Note that this example requires libcurl 7.20.0 or above. */ -/* - * This is the list of basic details you need to tweak to get things right. - */ -#define SERVER "smtp.example.com" -#define PORT ":587" /* it is a colon+port string, but you can set it - to "" to use the default port */ #define FROM "" #define TO "" #define CC "" @@ -46,7 +41,7 @@ static const char *payload_text[] = { "From: " FROM "(Example User)\r\n", "Cc: " CC "(Another example User)\r\n", "Message-ID: \r\n", - "Subject: SMTP TLS example message\r\n", + "Subject: SMTP multi example message\r\n", "\r\n", /* empty line to divide headers from body, see RFC5322 */ "The body of the message starts here.\r\n", "\r\n", @@ -125,20 +120,12 @@ int main(void) recipients = curl_slist_append(recipients, TO); recipients = curl_slist_append(recipients, CC); - curl_easy_setopt(curl, CURLOPT_URL, "smtp://" SERVER PORT); - curl_easy_setopt(curl, CURLOPT_USERNAME, "user"); - curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret"); + curl_easy_setopt(curl, CURLOPT_URL, "smtp://smtp.example.com"); 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_MAIL_FROM, FROM); curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients); - curl_easy_setopt(curl, CURLOPT_USE_SSL, (long)CURLUSESSL_ALL); - curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); - curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L); - curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); - curl_easy_setopt(curl, CURLOPT_SSLVERSION, 0L); - curl_easy_setopt(curl, CURLOPT_SSL_SESSIONID_CACHE, 0L); curl_multi_add_handle(mcurl, curl); mp_start = tvnow(); @@ -184,7 +171,7 @@ int main(void) to sleep. */ rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout); - if (tvdiff(tvnow(), mp_start) > MULTI_PERFORM_HANG_TIMEOUT) { + if(tvdiff(tvnow(), mp_start) > MULTI_PERFORM_HANG_TIMEOUT) { fprintf(stderr, "ABORTING TEST, since it seems " "that it would have run forever.\n"); break; -- cgit v1.2.3