From 5220c1d69240dfab2087990d24229f81db9b4b33 Mon Sep 17 00:00:00 2001 From: Steve Holme Date: Sat, 4 Jan 2014 18:10:18 +0000 Subject: examples: Standardised username and password settings for all email examples Replaced the use of CURLOPT_USERPWD for the preferred CURLOPT_USERNAME and CURLOPT_PASSWORD options and used the same username and password for all email examples which is the same as that used in the test suite. --- docs/examples/smtp-tls.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'docs/examples/smtp-tls.c') diff --git a/docs/examples/smtp-tls.c b/docs/examples/smtp-tls.c index 1ab7e205b..15f946586 100644 --- a/docs/examples/smtp-tls.c +++ b/docs/examples/smtp-tls.c @@ -24,8 +24,9 @@ #include /* This is a simple example showing how to send mail using libcurl's SMTP - * capabilities. It builds on the smtp-send.c example, adding some - * authentication and transport security. + * capabilities. It builds on the smtp-send.c example to add authentication + * and, more importantly, transport security to protect the authentication + * details from being snooped. */ #define FROM "" @@ -84,6 +85,10 @@ int main(void) curl = curl_easy_init(); if(curl) { + /* Set username and password */ + curl_easy_setopt(curl, CURLOPT_USERNAME, "user"); + curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret"); + /* 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 @@ -110,12 +115,6 @@ int main(void) * docs/SSLCERTS for more information. */ curl_easy_setopt(curl, CURLOPT_CAINFO, "/path/to/certificate.pem"); - /* A common reason for requiring transport security is to protect - * authentication details (user names and passwords) from being "snooped" - * on the network. Here is how the user name and password are provided: */ - curl_easy_setopt(curl, CURLOPT_USERNAME, "user@example.net"); - curl_easy_setopt(curl, CURLOPT_PASSWORD, "P@ssw0rd"); - /* Value for envelope reverse-path */ curl_easy_setopt(curl, CURLOPT_MAIL_FROM, FROM); -- cgit v1.2.3