aboutsummaryrefslogtreecommitdiff
path: root/docs/examples/smtp-tls.c
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2014-01-04 18:10:18 +0000
committerSteve Holme <steve_holme@hotmail.com>2014-01-04 18:12:02 +0000
commit5220c1d69240dfab2087990d24229f81db9b4b33 (patch)
tree1abf2c637f0cfdf08e7327d0b00c934bc7d1d704 /docs/examples/smtp-tls.c
parent84a9f092dc187400cfd2448c73f44602b042c1b1 (diff)
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.
Diffstat (limited to 'docs/examples/smtp-tls.c')
-rw-r--r--docs/examples/smtp-tls.c15
1 files changed, 7 insertions, 8 deletions
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 <curl/curl.h>
/* 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 "<sender@example.org>"
@@ -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);