summaryrefslogtreecommitdiff
path: root/docs/examples
diff options
context:
space:
mode:
Diffstat (limited to 'docs/examples')
-rw-r--r--docs/examples/Makefile.in401
-rw-r--r--docs/examples/Makefile.inc8
-rw-r--r--docs/examples/imap-append.c115
-rw-r--r--docs/examples/imap-copy.c65
-rw-r--r--docs/examples/imap-create.c61
-rw-r--r--docs/examples/imap-delete.c61
-rw-r--r--docs/examples/imap-examine.c61
-rw-r--r--docs/examples/imap-fetch.c (renamed from docs/examples/imap.c)24
-rw-r--r--docs/examples/imap-list.c60
-rw-r--r--docs/examples/imap-multi.c145
-rw-r--r--docs/examples/imap-noop.c61
-rw-r--r--docs/examples/imap-search.c65
-rw-r--r--docs/examples/imap-ssl.c (renamed from docs/examples/pop3slist.c)48
-rw-r--r--docs/examples/imap-store.c76
-rw-r--r--docs/examples/imap-tls.c84
-rw-r--r--docs/examples/pop3-dele.c64
-rw-r--r--docs/examples/pop3-list.c58
-rw-r--r--docs/examples/pop3-multi.c145
-rw-r--r--docs/examples/pop3-noop.c64
-rw-r--r--docs/examples/pop3-retr.c58
-rw-r--r--docs/examples/pop3-ssl.c (renamed from docs/examples/pop3s.c)48
-rw-r--r--docs/examples/pop3-stat.c64
-rw-r--r--docs/examples/pop3-tls.c84
-rw-r--r--docs/examples/pop3-top.c61
-rw-r--r--docs/examples/pop3-uidl.c61
-rw-r--r--docs/examples/simplesmtp.c87
-rw-r--r--docs/examples/smtp-expn.c73
-rw-r--r--docs/examples/smtp-mail.c137
-rw-r--r--docs/examples/smtp-multi.c182
-rw-r--r--docs/examples/smtp-ssl.c161
-rw-r--r--docs/examples/smtp-tls.c85
-rw-r--r--docs/examples/smtp-vrfy.c73
32 files changed, 2535 insertions, 305 deletions
diff --git a/docs/examples/Makefile.in b/docs/examples/Makefile.in
index 2fca8323..269ba4ba 100644
--- a/docs/examples/Makefile.in
+++ b/docs/examples/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.14 from Makefile.am.
+# Makefile.in generated by automake 1.14.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
@@ -115,10 +115,18 @@ check_PROGRAMS = 10-at-a-time$(EXEEXT) anyauthput$(EXEEXT) \
simple$(EXEEXT) simplepost$(EXEEXT) simplessl$(EXEEXT) \
sendrecv$(EXEEXT) httpcustomheader$(EXEEXT) certinfo$(EXEEXT) \
chkspeed$(EXEEXT) ftpgetinfo$(EXEEXT) ftp-wildcard$(EXEEXT) \
- smtp-multi$(EXEEXT) simplesmtp$(EXEEXT) smtp-tls$(EXEEXT) \
+ smtp-mail$(EXEEXT) smtp-multi$(EXEEXT) smtp-ssl$(EXEEXT) \
+ smtp-tls$(EXEEXT) smtp-vrfy$(EXEEXT) smtp-expn$(EXEEXT) \
rtsp$(EXEEXT) externalsocket$(EXEEXT) resolve$(EXEEXT) \
- progressfunc$(EXEEXT) pop3s$(EXEEXT) pop3slist$(EXEEXT) \
- imap$(EXEEXT) url2file$(EXEEXT) sftpget$(EXEEXT) \
+ progressfunc$(EXEEXT) pop3-retr$(EXEEXT) pop3-list$(EXEEXT) \
+ pop3-uidl$(EXEEXT) pop3-dele$(EXEEXT) pop3-top$(EXEEXT) \
+ pop3-stat$(EXEEXT) pop3-noop$(EXEEXT) pop3-ssl$(EXEEXT) \
+ pop3-tls$(EXEEXT) pop3-multi$(EXEEXT) imap-list$(EXEEXT) \
+ imap-fetch$(EXEEXT) imap-store$(EXEEXT) imap-append$(EXEEXT) \
+ imap-examine$(EXEEXT) imap-search$(EXEEXT) \
+ imap-create$(EXEEXT) imap-delete$(EXEEXT) imap-copy$(EXEEXT) \
+ imap-noop$(EXEEXT) imap-ssl$(EXEEXT) imap-tls$(EXEEXT) \
+ imap-multi$(EXEEXT) url2file$(EXEEXT) sftpget$(EXEEXT) \
ftpsget$(EXEEXT) postinmemory$(EXEEXT)
subdir = docs/examples
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -294,11 +302,97 @@ https_LDADD = $(LDADD)
@USE_EXPLICIT_LIB_DEPS_FALSE@https_DEPENDENCIES = \
@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la
@USE_EXPLICIT_LIB_DEPS_TRUE@https_DEPENDENCIES = $(LIBDIR)/libcurl.la
-imap_SOURCES = imap.c
-imap_OBJECTS = imap.$(OBJEXT)
-imap_LDADD = $(LDADD)
-@USE_EXPLICIT_LIB_DEPS_FALSE@imap_DEPENDENCIES = $(LIBDIR)/libcurl.la
-@USE_EXPLICIT_LIB_DEPS_TRUE@imap_DEPENDENCIES = $(LIBDIR)/libcurl.la
+imap_append_SOURCES = imap-append.c
+imap_append_OBJECTS = imap-append.$(OBJEXT)
+imap_append_LDADD = $(LDADD)
+@USE_EXPLICIT_LIB_DEPS_FALSE@imap_append_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la
+@USE_EXPLICIT_LIB_DEPS_TRUE@imap_append_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la
+imap_copy_SOURCES = imap-copy.c
+imap_copy_OBJECTS = imap-copy.$(OBJEXT)
+imap_copy_LDADD = $(LDADD)
+@USE_EXPLICIT_LIB_DEPS_FALSE@imap_copy_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la
+@USE_EXPLICIT_LIB_DEPS_TRUE@imap_copy_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la
+imap_create_SOURCES = imap-create.c
+imap_create_OBJECTS = imap-create.$(OBJEXT)
+imap_create_LDADD = $(LDADD)
+@USE_EXPLICIT_LIB_DEPS_FALSE@imap_create_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la
+@USE_EXPLICIT_LIB_DEPS_TRUE@imap_create_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la
+imap_delete_SOURCES = imap-delete.c
+imap_delete_OBJECTS = imap-delete.$(OBJEXT)
+imap_delete_LDADD = $(LDADD)
+@USE_EXPLICIT_LIB_DEPS_FALSE@imap_delete_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la
+@USE_EXPLICIT_LIB_DEPS_TRUE@imap_delete_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la
+imap_examine_SOURCES = imap-examine.c
+imap_examine_OBJECTS = imap-examine.$(OBJEXT)
+imap_examine_LDADD = $(LDADD)
+@USE_EXPLICIT_LIB_DEPS_FALSE@imap_examine_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la
+@USE_EXPLICIT_LIB_DEPS_TRUE@imap_examine_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la
+imap_fetch_SOURCES = imap-fetch.c
+imap_fetch_OBJECTS = imap-fetch.$(OBJEXT)
+imap_fetch_LDADD = $(LDADD)
+@USE_EXPLICIT_LIB_DEPS_FALSE@imap_fetch_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la
+@USE_EXPLICIT_LIB_DEPS_TRUE@imap_fetch_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la
+imap_list_SOURCES = imap-list.c
+imap_list_OBJECTS = imap-list.$(OBJEXT)
+imap_list_LDADD = $(LDADD)
+@USE_EXPLICIT_LIB_DEPS_FALSE@imap_list_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la
+@USE_EXPLICIT_LIB_DEPS_TRUE@imap_list_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la
+imap_multi_SOURCES = imap-multi.c
+imap_multi_OBJECTS = imap-multi.$(OBJEXT)
+imap_multi_LDADD = $(LDADD)
+@USE_EXPLICIT_LIB_DEPS_FALSE@imap_multi_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la
+@USE_EXPLICIT_LIB_DEPS_TRUE@imap_multi_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la
+imap_noop_SOURCES = imap-noop.c
+imap_noop_OBJECTS = imap-noop.$(OBJEXT)
+imap_noop_LDADD = $(LDADD)
+@USE_EXPLICIT_LIB_DEPS_FALSE@imap_noop_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la
+@USE_EXPLICIT_LIB_DEPS_TRUE@imap_noop_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la
+imap_search_SOURCES = imap-search.c
+imap_search_OBJECTS = imap-search.$(OBJEXT)
+imap_search_LDADD = $(LDADD)
+@USE_EXPLICIT_LIB_DEPS_FALSE@imap_search_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la
+@USE_EXPLICIT_LIB_DEPS_TRUE@imap_search_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la
+imap_ssl_SOURCES = imap-ssl.c
+imap_ssl_OBJECTS = imap-ssl.$(OBJEXT)
+imap_ssl_LDADD = $(LDADD)
+@USE_EXPLICIT_LIB_DEPS_FALSE@imap_ssl_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la
+@USE_EXPLICIT_LIB_DEPS_TRUE@imap_ssl_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la
+imap_store_SOURCES = imap-store.c
+imap_store_OBJECTS = imap-store.$(OBJEXT)
+imap_store_LDADD = $(LDADD)
+@USE_EXPLICIT_LIB_DEPS_FALSE@imap_store_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la
+@USE_EXPLICIT_LIB_DEPS_TRUE@imap_store_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la
+imap_tls_SOURCES = imap-tls.c
+imap_tls_OBJECTS = imap-tls.$(OBJEXT)
+imap_tls_LDADD = $(LDADD)
+@USE_EXPLICIT_LIB_DEPS_FALSE@imap_tls_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la
+@USE_EXPLICIT_LIB_DEPS_TRUE@imap_tls_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la
multi_app_SOURCES = multi-app.c
multi_app_OBJECTS = multi-app.$(OBJEXT)
multi_app_LDADD = $(LDADD)
@@ -341,18 +435,75 @@ persistant_LDADD = $(LDADD)
@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la
@USE_EXPLICIT_LIB_DEPS_TRUE@persistant_DEPENDENCIES = \
@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la
-pop3s_SOURCES = pop3s.c
-pop3s_OBJECTS = pop3s.$(OBJEXT)
-pop3s_LDADD = $(LDADD)
-@USE_EXPLICIT_LIB_DEPS_FALSE@pop3s_DEPENDENCIES = \
+pop3_dele_SOURCES = pop3-dele.c
+pop3_dele_OBJECTS = pop3-dele.$(OBJEXT)
+pop3_dele_LDADD = $(LDADD)
+@USE_EXPLICIT_LIB_DEPS_FALSE@pop3_dele_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la
+@USE_EXPLICIT_LIB_DEPS_TRUE@pop3_dele_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la
+pop3_list_SOURCES = pop3-list.c
+pop3_list_OBJECTS = pop3-list.$(OBJEXT)
+pop3_list_LDADD = $(LDADD)
+@USE_EXPLICIT_LIB_DEPS_FALSE@pop3_list_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la
+@USE_EXPLICIT_LIB_DEPS_TRUE@pop3_list_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la
+pop3_multi_SOURCES = pop3-multi.c
+pop3_multi_OBJECTS = pop3-multi.$(OBJEXT)
+pop3_multi_LDADD = $(LDADD)
+@USE_EXPLICIT_LIB_DEPS_FALSE@pop3_multi_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la
+@USE_EXPLICIT_LIB_DEPS_TRUE@pop3_multi_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la
+pop3_noop_SOURCES = pop3-noop.c
+pop3_noop_OBJECTS = pop3-noop.$(OBJEXT)
+pop3_noop_LDADD = $(LDADD)
+@USE_EXPLICIT_LIB_DEPS_FALSE@pop3_noop_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la
+@USE_EXPLICIT_LIB_DEPS_TRUE@pop3_noop_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la
+pop3_retr_SOURCES = pop3-retr.c
+pop3_retr_OBJECTS = pop3-retr.$(OBJEXT)
+pop3_retr_LDADD = $(LDADD)
+@USE_EXPLICIT_LIB_DEPS_FALSE@pop3_retr_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la
+@USE_EXPLICIT_LIB_DEPS_TRUE@pop3_retr_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la
+pop3_ssl_SOURCES = pop3-ssl.c
+pop3_ssl_OBJECTS = pop3-ssl.$(OBJEXT)
+pop3_ssl_LDADD = $(LDADD)
+@USE_EXPLICIT_LIB_DEPS_FALSE@pop3_ssl_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la
+@USE_EXPLICIT_LIB_DEPS_TRUE@pop3_ssl_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la
+pop3_stat_SOURCES = pop3-stat.c
+pop3_stat_OBJECTS = pop3-stat.$(OBJEXT)
+pop3_stat_LDADD = $(LDADD)
+@USE_EXPLICIT_LIB_DEPS_FALSE@pop3_stat_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la
+@USE_EXPLICIT_LIB_DEPS_TRUE@pop3_stat_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la
+pop3_tls_SOURCES = pop3-tls.c
+pop3_tls_OBJECTS = pop3-tls.$(OBJEXT)
+pop3_tls_LDADD = $(LDADD)
+@USE_EXPLICIT_LIB_DEPS_FALSE@pop3_tls_DEPENDENCIES = \
@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la
-@USE_EXPLICIT_LIB_DEPS_TRUE@pop3s_DEPENDENCIES = $(LIBDIR)/libcurl.la
-pop3slist_SOURCES = pop3slist.c
-pop3slist_OBJECTS = pop3slist.$(OBJEXT)
-pop3slist_LDADD = $(LDADD)
-@USE_EXPLICIT_LIB_DEPS_FALSE@pop3slist_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_TRUE@pop3_tls_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la
+pop3_top_SOURCES = pop3-top.c
+pop3_top_OBJECTS = pop3-top.$(OBJEXT)
+pop3_top_LDADD = $(LDADD)
+@USE_EXPLICIT_LIB_DEPS_FALSE@pop3_top_DEPENDENCIES = \
@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la
-@USE_EXPLICIT_LIB_DEPS_TRUE@pop3slist_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_TRUE@pop3_top_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la
+pop3_uidl_SOURCES = pop3-uidl.c
+pop3_uidl_OBJECTS = pop3-uidl.$(OBJEXT)
+pop3_uidl_LDADD = $(LDADD)
+@USE_EXPLICIT_LIB_DEPS_FALSE@pop3_uidl_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la
+@USE_EXPLICIT_LIB_DEPS_TRUE@pop3_uidl_DEPENDENCIES = \
@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la
post_callback_SOURCES = post-callback.c
post_callback_OBJECTS = post-callback.$(OBJEXT)
@@ -429,13 +580,6 @@ simplepost_LDADD = $(LDADD)
@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la
@USE_EXPLICIT_LIB_DEPS_TRUE@simplepost_DEPENDENCIES = \
@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la
-simplesmtp_SOURCES = simplesmtp.c
-simplesmtp_OBJECTS = simplesmtp.$(OBJEXT)
-simplesmtp_LDADD = $(LDADD)
-@USE_EXPLICIT_LIB_DEPS_FALSE@simplesmtp_DEPENDENCIES = \
-@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la
-@USE_EXPLICIT_LIB_DEPS_TRUE@simplesmtp_DEPENDENCIES = \
-@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la
simplessl_SOURCES = simplessl.c
simplessl_OBJECTS = simplessl.$(OBJEXT)
simplessl_LDADD = $(LDADD)
@@ -443,6 +587,20 @@ simplessl_LDADD = $(LDADD)
@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la
@USE_EXPLICIT_LIB_DEPS_TRUE@simplessl_DEPENDENCIES = \
@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la
+smtp_expn_SOURCES = smtp-expn.c
+smtp_expn_OBJECTS = smtp-expn.$(OBJEXT)
+smtp_expn_LDADD = $(LDADD)
+@USE_EXPLICIT_LIB_DEPS_FALSE@smtp_expn_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la
+@USE_EXPLICIT_LIB_DEPS_TRUE@smtp_expn_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la
+smtp_mail_SOURCES = smtp-mail.c
+smtp_mail_OBJECTS = smtp-mail.$(OBJEXT)
+smtp_mail_LDADD = $(LDADD)
+@USE_EXPLICIT_LIB_DEPS_FALSE@smtp_mail_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la
+@USE_EXPLICIT_LIB_DEPS_TRUE@smtp_mail_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la
smtp_multi_SOURCES = smtp-multi.c
smtp_multi_OBJECTS = smtp-multi.$(OBJEXT)
smtp_multi_LDADD = $(LDADD)
@@ -450,6 +608,13 @@ smtp_multi_LDADD = $(LDADD)
@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la
@USE_EXPLICIT_LIB_DEPS_TRUE@smtp_multi_DEPENDENCIES = \
@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la
+smtp_ssl_SOURCES = smtp-ssl.c
+smtp_ssl_OBJECTS = smtp-ssl.$(OBJEXT)
+smtp_ssl_LDADD = $(LDADD)
+@USE_EXPLICIT_LIB_DEPS_FALSE@smtp_ssl_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la
+@USE_EXPLICIT_LIB_DEPS_TRUE@smtp_ssl_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la
smtp_tls_SOURCES = smtp-tls.c
smtp_tls_OBJECTS = smtp-tls.$(OBJEXT)
smtp_tls_LDADD = $(LDADD)
@@ -457,6 +622,13 @@ smtp_tls_LDADD = $(LDADD)
@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la
@USE_EXPLICIT_LIB_DEPS_TRUE@smtp_tls_DEPENDENCIES = \
@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la
+smtp_vrfy_SOURCES = smtp-vrfy.c
+smtp_vrfy_OBJECTS = smtp-vrfy.$(OBJEXT)
+smtp_vrfy_LDADD = $(LDADD)
+@USE_EXPLICIT_LIB_DEPS_FALSE@smtp_vrfy_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la
+@USE_EXPLICIT_LIB_DEPS_TRUE@smtp_vrfy_DEPENDENCIES = \
+@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la
url2file_SOURCES = url2file.c
url2file_OBJECTS = url2file.$(OBJEXT)
url2file_LDADD = $(LDADD)
@@ -502,24 +674,32 @@ SOURCES = 10-at-a-time.c anyauthput.c certinfo.c chkspeed.c \
cookie_interface.c debug.c externalsocket.c fileupload.c \
fopen.c ftp-wildcard.c ftpget.c ftpgetinfo.c ftpgetresp.c \
ftpsget.c ftpupload.c getinfo.c getinmemory.c http-post.c \
- httpcustomheader.c httpput.c https.c imap.c multi-app.c \
- multi-debugcallback.c multi-double.c multi-post.c \
- multi-single.c persistant.c pop3s.c pop3slist.c \
+ httpcustomheader.c httpput.c https.c imap-append.c imap-copy.c \
+ imap-create.c imap-delete.c imap-examine.c imap-fetch.c \
+ imap-list.c imap-multi.c imap-noop.c imap-search.c imap-ssl.c \
+ imap-store.c imap-tls.c multi-app.c multi-debugcallback.c \
+ multi-double.c multi-post.c multi-single.c persistant.c \
+ pop3-dele.c pop3-list.c pop3-multi.c pop3-noop.c pop3-retr.c \
+ pop3-ssl.c pop3-stat.c pop3-tls.c pop3-top.c pop3-uidl.c \
post-callback.c postinmemory.c postit2.c progressfunc.c \
resolve.c rtsp.c sendrecv.c sepheaders.c sftpget.c simple.c \
- simplepost.c simplesmtp.c simplessl.c smtp-multi.c smtp-tls.c \
- url2file.c
+ simplepost.c simplessl.c smtp-expn.c smtp-mail.c smtp-multi.c \
+ smtp-ssl.c smtp-tls.c smtp-vrfy.c url2file.c
DIST_SOURCES = 10-at-a-time.c anyauthput.c certinfo.c chkspeed.c \
cookie_interface.c debug.c externalsocket.c fileupload.c \
fopen.c ftp-wildcard.c ftpget.c ftpgetinfo.c ftpgetresp.c \
ftpsget.c ftpupload.c getinfo.c getinmemory.c http-post.c \
- httpcustomheader.c httpput.c https.c imap.c multi-app.c \
- multi-debugcallback.c multi-double.c multi-post.c \
- multi-single.c persistant.c pop3s.c pop3slist.c \
+ httpcustomheader.c httpput.c https.c imap-append.c imap-copy.c \
+ imap-create.c imap-delete.c imap-examine.c imap-fetch.c \
+ imap-list.c imap-multi.c imap-noop.c imap-search.c imap-ssl.c \
+ imap-store.c imap-tls.c multi-app.c multi-debugcallback.c \
+ multi-double.c multi-post.c multi-single.c persistant.c \
+ pop3-dele.c pop3-list.c pop3-multi.c pop3-noop.c pop3-retr.c \
+ pop3-ssl.c pop3-stat.c pop3-tls.c pop3-top.c pop3-uidl.c \
post-callback.c postinmemory.c postit2.c progressfunc.c \
resolve.c rtsp.c sendrecv.c sepheaders.c sftpget.c simple.c \
- simplepost.c simplesmtp.c simplessl.c smtp-multi.c smtp-tls.c \
- url2file.c
+ simplepost.c simplessl.c smtp-expn.c smtp-mail.c smtp-multi.c \
+ smtp-ssl.c smtp-tls.c smtp-vrfy.c url2file.c
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
@@ -890,9 +1070,57 @@ https$(EXEEXT): $(https_OBJECTS) $(https_DEPENDENCIES) $(EXTRA_https_DEPENDENCIE
@rm -f https$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(https_OBJECTS) $(https_LDADD) $(LIBS)
-imap$(EXEEXT): $(imap_OBJECTS) $(imap_DEPENDENCIES) $(EXTRA_imap_DEPENDENCIES)
- @rm -f imap$(EXEEXT)
- $(AM_V_CCLD)$(LINK) $(imap_OBJECTS) $(imap_LDADD) $(LIBS)
+imap-append$(EXEEXT): $(imap_append_OBJECTS) $(imap_append_DEPENDENCIES) $(EXTRA_imap_append_DEPENDENCIES)
+ @rm -f imap-append$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(imap_append_OBJECTS) $(imap_append_LDADD) $(LIBS)
+
+imap-copy$(EXEEXT): $(imap_copy_OBJECTS) $(imap_copy_DEPENDENCIES) $(EXTRA_imap_copy_DEPENDENCIES)
+ @rm -f imap-copy$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(imap_copy_OBJECTS) $(imap_copy_LDADD) $(LIBS)
+
+imap-create$(EXEEXT): $(imap_create_OBJECTS) $(imap_create_DEPENDENCIES) $(EXTRA_imap_create_DEPENDENCIES)
+ @rm -f imap-create$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(imap_create_OBJECTS) $(imap_create_LDADD) $(LIBS)
+
+imap-delete$(EXEEXT): $(imap_delete_OBJECTS) $(imap_delete_DEPENDENCIES) $(EXTRA_imap_delete_DEPENDENCIES)
+ @rm -f imap-delete$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(imap_delete_OBJECTS) $(imap_delete_LDADD) $(LIBS)
+
+imap-examine$(EXEEXT): $(imap_examine_OBJECTS) $(imap_examine_DEPENDENCIES) $(EXTRA_imap_examine_DEPENDENCIES)
+ @rm -f imap-examine$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(imap_examine_OBJECTS) $(imap_examine_LDADD) $(LIBS)
+
+imap-fetch$(EXEEXT): $(imap_fetch_OBJECTS) $(imap_fetch_DEPENDENCIES) $(EXTRA_imap_fetch_DEPENDENCIES)
+ @rm -f imap-fetch$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(imap_fetch_OBJECTS) $(imap_fetch_LDADD) $(LIBS)
+
+imap-list$(EXEEXT): $(imap_list_OBJECTS) $(imap_list_DEPENDENCIES) $(EXTRA_imap_list_DEPENDENCIES)
+ @rm -f imap-list$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(imap_list_OBJECTS) $(imap_list_LDADD) $(LIBS)
+
+imap-multi$(EXEEXT): $(imap_multi_OBJECTS) $(imap_multi_DEPENDENCIES) $(EXTRA_imap_multi_DEPENDENCIES)
+ @rm -f imap-multi$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(imap_multi_OBJECTS) $(imap_multi_LDADD) $(LIBS)
+
+imap-noop$(EXEEXT): $(imap_noop_OBJECTS) $(imap_noop_DEPENDENCIES) $(EXTRA_imap_noop_DEPENDENCIES)
+ @rm -f imap-noop$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(imap_noop_OBJECTS) $(imap_noop_LDADD) $(LIBS)
+
+imap-search$(EXEEXT): $(imap_search_OBJECTS) $(imap_search_DEPENDENCIES) $(EXTRA_imap_search_DEPENDENCIES)
+ @rm -f imap-search$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(imap_search_OBJECTS) $(imap_search_LDADD) $(LIBS)
+
+imap-ssl$(EXEEXT): $(imap_ssl_OBJECTS) $(imap_ssl_DEPENDENCIES) $(EXTRA_imap_ssl_DEPENDENCIES)
+ @rm -f imap-ssl$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(imap_ssl_OBJECTS) $(imap_ssl_LDADD) $(LIBS)
+
+imap-store$(EXEEXT): $(imap_store_OBJECTS) $(imap_store_DEPENDENCIES) $(EXTRA_imap_store_DEPENDENCIES)
+ @rm -f imap-store$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(imap_store_OBJECTS) $(imap_store_LDADD) $(LIBS)
+
+imap-tls$(EXEEXT): $(imap_tls_OBJECTS) $(imap_tls_DEPENDENCIES) $(EXTRA_imap_tls_DEPENDENCIES)
+ @rm -f imap-tls$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(imap_tls_OBJECTS) $(imap_tls_LDADD) $(LIBS)
multi-app$(EXEEXT): $(multi_app_OBJECTS) $(multi_app_DEPENDENCIES) $(EXTRA_multi_app_DEPENDENCIES)
@rm -f multi-app$(EXEEXT)
@@ -918,13 +1146,45 @@ persistant$(EXEEXT): $(persistant_OBJECTS) $(persistant_DEPENDENCIES) $(EXTRA_pe
@rm -f persistant$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(persistant_OBJECTS) $(persistant_LDADD) $(LIBS)
-pop3s$(EXEEXT): $(pop3s_OBJECTS) $(pop3s_DEPENDENCIES) $(EXTRA_pop3s_DEPENDENCIES)
- @rm -f pop3s$(EXEEXT)
- $(AM_V_CCLD)$(LINK) $(pop3s_OBJECTS) $(pop3s_LDADD) $(LIBS)
+pop3-dele$(EXEEXT): $(pop3_dele_OBJECTS) $(pop3_dele_DEPENDENCIES) $(EXTRA_pop3_dele_DEPENDENCIES)
+ @rm -f pop3-dele$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(pop3_dele_OBJECTS) $(pop3_dele_LDADD) $(LIBS)
+
+pop3-list$(EXEEXT): $(pop3_list_OBJECTS) $(pop3_list_DEPENDENCIES) $(EXTRA_pop3_list_DEPENDENCIES)
+ @rm -f pop3-list$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(pop3_list_OBJECTS) $(pop3_list_LDADD) $(LIBS)
+
+pop3-multi$(EXEEXT): $(pop3_multi_OBJECTS) $(pop3_multi_DEPENDENCIES) $(EXTRA_pop3_multi_DEPENDENCIES)
+ @rm -f pop3-multi$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(pop3_multi_OBJECTS) $(pop3_multi_LDADD) $(LIBS)
+
+pop3-noop$(EXEEXT): $(pop3_noop_OBJECTS) $(pop3_noop_DEPENDENCIES) $(EXTRA_pop3_noop_DEPENDENCIES)
+ @rm -f pop3-noop$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(pop3_noop_OBJECTS) $(pop3_noop_LDADD) $(LIBS)
+
+pop3-retr$(EXEEXT): $(pop3_retr_OBJECTS) $(pop3_retr_DEPENDENCIES) $(EXTRA_pop3_retr_DEPENDENCIES)
+ @rm -f pop3-retr$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(pop3_retr_OBJECTS) $(pop3_retr_LDADD) $(LIBS)
-pop3slist$(EXEEXT): $(pop3slist_OBJECTS) $(pop3slist_DEPENDENCIES) $(EXTRA_pop3slist_DEPENDENCIES)
- @rm -f pop3slist$(EXEEXT)
- $(AM_V_CCLD)$(LINK) $(pop3slist_OBJECTS) $(pop3slist_LDADD) $(LIBS)
+pop3-ssl$(EXEEXT): $(pop3_ssl_OBJECTS) $(pop3_ssl_DEPENDENCIES) $(EXTRA_pop3_ssl_DEPENDENCIES)
+ @rm -f pop3-ssl$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(pop3_ssl_OBJECTS) $(pop3_ssl_LDADD) $(LIBS)
+
+pop3-stat$(EXEEXT): $(pop3_stat_OBJECTS) $(pop3_stat_DEPENDENCIES) $(EXTRA_pop3_stat_DEPENDENCIES)
+ @rm -f pop3-stat$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(pop3_stat_OBJECTS) $(pop3_stat_LDADD) $(LIBS)
+
+pop3-tls$(EXEEXT): $(pop3_tls_OBJECTS) $(pop3_tls_DEPENDENCIES) $(EXTRA_pop3_tls_DEPENDENCIES)
+ @rm -f pop3-tls$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(pop3_tls_OBJECTS) $(pop3_tls_LDADD) $(LIBS)
+
+pop3-top$(EXEEXT): $(pop3_top_OBJECTS) $(pop3_top_DEPENDENCIES) $(EXTRA_pop3_top_DEPENDENCIES)
+ @rm -f pop3-top$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(pop3_top_OBJECTS) $(pop3_top_LDADD) $(LIBS)
+
+pop3-uidl$(EXEEXT): $(pop3_uidl_OBJECTS) $(pop3_uidl_DEPENDENCIES) $(EXTRA_pop3_uidl_DEPENDENCIES)
+ @rm -f pop3-uidl$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(pop3_uidl_OBJECTS) $(pop3_uidl_LDADD) $(LIBS)
post-callback$(EXEEXT): $(post_callback_OBJECTS) $(post_callback_DEPENDENCIES) $(EXTRA_post_callback_DEPENDENCIES)
@rm -f post-callback$(EXEEXT)
@@ -970,22 +1230,34 @@ simplepost$(EXEEXT): $(simplepost_OBJECTS) $(simplepost_DEPENDENCIES) $(EXTRA_si
@rm -f simplepost$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(simplepost_OBJECTS) $(simplepost_LDADD) $(LIBS)
-simplesmtp$(EXEEXT): $(simplesmtp_OBJECTS) $(simplesmtp_DEPENDENCIES) $(EXTRA_simplesmtp_DEPENDENCIES)
- @rm -f simplesmtp$(EXEEXT)
- $(AM_V_CCLD)$(LINK) $(simplesmtp_OBJECTS) $(simplesmtp_LDADD) $(LIBS)
-
simplessl$(EXEEXT): $(simplessl_OBJECTS) $(simplessl_DEPENDENCIES) $(EXTRA_simplessl_DEPENDENCIES)
@rm -f simplessl$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(simplessl_OBJECTS) $(simplessl_LDADD) $(LIBS)
+smtp-expn$(EXEEXT): $(smtp_expn_OBJECTS) $(smtp_expn_DEPENDENCIES) $(EXTRA_smtp_expn_DEPENDENCIES)
+ @rm -f smtp-expn$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(smtp_expn_OBJECTS) $(smtp_expn_LDADD) $(LIBS)
+
+smtp-mail$(EXEEXT): $(smtp_mail_OBJECTS) $(smtp_mail_DEPENDENCIES) $(EXTRA_smtp_mail_DEPENDENCIES)
+ @rm -f smtp-mail$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(smtp_mail_OBJECTS) $(smtp_mail_LDADD) $(LIBS)
+
smtp-multi$(EXEEXT): $(smtp_multi_OBJECTS) $(smtp_multi_DEPENDENCIES) $(EXTRA_smtp_multi_DEPENDENCIES)
@rm -f smtp-multi$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(smtp_multi_OBJECTS) $(smtp_multi_LDADD) $(LIBS)
+smtp-ssl$(EXEEXT): $(smtp_ssl_OBJECTS) $(smtp_ssl_DEPENDENCIES) $(EXTRA_smtp_ssl_DEPENDENCIES)
+ @rm -f smtp-ssl$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(smtp_ssl_OBJECTS) $(smtp_ssl_LDADD) $(LIBS)
+
smtp-tls$(EXEEXT): $(smtp_tls_OBJECTS) $(smtp_tls_DEPENDENCIES) $(EXTRA_smtp_tls_DEPENDENCIES)
@rm -f smtp-tls$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(smtp_tls_OBJECTS) $(smtp_tls_LDADD) $(LIBS)
+smtp-vrfy$(EXEEXT): $(smtp_vrfy_OBJECTS) $(smtp_vrfy_DEPENDENCIES) $(EXTRA_smtp_vrfy_DEPENDENCIES)
+ @rm -f smtp-vrfy$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(smtp_vrfy_OBJECTS) $(smtp_vrfy_LDADD) $(LIBS)
+
url2file$(EXEEXT): $(url2file_OBJECTS) $(url2file_DEPENDENCIES) $(EXTRA_url2file_DEPENDENCIES)
@rm -f url2file$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(url2file_OBJECTS) $(url2file_LDADD) $(LIBS)
@@ -1017,15 +1289,35 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/httpcustomheader.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/httpput.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/https.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imap.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imap-append.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imap-copy.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imap-create.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imap-delete.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imap-examine.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imap-fetch.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imap-list.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imap-multi.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imap-noop.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imap-search.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imap-ssl.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imap-store.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imap-tls.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/multi-app.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/multi-debugcallback.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/multi-double.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/multi-post.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/multi-single.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/persistant.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pop3s.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pop3slist.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pop3-dele.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pop3-list.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pop3-multi.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pop3-noop.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pop3-retr.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pop3-ssl.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pop3-stat.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pop3-tls.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pop3-top.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pop3-uidl.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/post-callback.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/postinmemory.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/postit2.Po@am__quote@
@@ -1037,10 +1329,13 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sftpget.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simple.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simplepost.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simplesmtp.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simplessl.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smtp-expn.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smtp-mail.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smtp-multi.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smtp-ssl.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smtp-tls.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smtp-vrfy.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/url2file.Po@am__quote@
.c.o:
diff --git a/docs/examples/Makefile.inc b/docs/examples/Makefile.inc
index 6a97bc27..dda08750 100644
--- a/docs/examples/Makefile.inc
+++ b/docs/examples/Makefile.inc
@@ -4,8 +4,12 @@ check_PROGRAMS = 10-at-a-time anyauthput cookie_interface debug fileupload \
https multi-app multi-debugcallback multi-double multi-post multi-single \
persistant post-callback postit2 sepheaders simple simplepost simplessl \
sendrecv httpcustomheader certinfo chkspeed ftpgetinfo ftp-wildcard \
- smtp-multi simplesmtp smtp-tls rtsp externalsocket resolve \
- progressfunc pop3s pop3slist imap url2file sftpget ftpsget postinmemory
+ smtp-mail smtp-multi smtp-ssl smtp-tls smtp-vrfy smtp-expn rtsp \
+ externalsocket resolve progressfunc pop3-retr pop3-list pop3-uidl pop3-dele \
+ pop3-top pop3-stat pop3-noop pop3-ssl pop3-tls pop3-multi imap-list \
+ imap-fetch imap-store imap-append imap-examine imap-search imap-create \
+ imap-delete imap-copy imap-noop imap-ssl imap-tls imap-multi url2file \
+ sftpget ftpsget postinmemory
# These examples require external dependencies that may not be commonly
# available on POSIX systems, so don't bother attempting to compile them here.
diff --git a/docs/examples/imap-append.c b/docs/examples/imap-append.c
new file mode 100644
index 00000000..8f0ebcb3
--- /dev/null
+++ b/docs/examples/imap-append.c
@@ -0,0 +1,115 @@
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+#include <stdio.h>
+#include <curl/curl.h>
+
+/* This is a simple example showing how to send mail using libcurl's IMAP
+ * capabilities.
+ *
+ * Note that this example requires libcurl 7.30.0 or above.
+ */
+
+#define FROM "<sender@example.org>"
+#define TO "<addressee@example.net>"
+#define CC "<info@example.org>"
+
+static const char *payload_text[] = {
+ "Date: Mon, 29 Nov 2010 21:54:29 +1100\r\n",
+ "To: " TO "\r\n",
+ "From: " FROM "(Example User)\r\n",
+ "Cc: " CC "(Another example User)\r\n",
+ "Message-ID: <dcd7cb36-11db-487a-9f3a-e652a9458efd@rfcpedant.example.org>\r\n",
+ "Subject: IMAP 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",
+ "It could be a lot of lines, could be MIME encoded, whatever.\r\n",
+ "Check RFC5322.\r\n",
+ NULL
+};
+
+struct upload_status {
+ int lines_read;
+};
+
+static size_t payload_source(void *ptr, size_t size, size_t nmemb, void *userp)
+{
+ struct upload_status *upload_ctx = (struct upload_status *)userp;
+ const char *data;
+
+ if((size == 0) || (nmemb == 0) || ((size*nmemb) < 1)) {
+ return 0;
+ }
+
+ data = payload_text[upload_ctx->lines_read];
+
+ if(data) {
+ size_t len = strlen(data);
+ memcpy(ptr, data, len);
+ upload_ctx->lines_read++;
+
+ return len;
+ }
+
+ return 0;
+}
+
+int main(void)
+{
+ CURL *curl;
+ CURLcode res = CURLE_OK;
+ struct upload_status upload_ctx;
+
+ upload_ctx.lines_read = 0;
+
+ 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 will create a new message 100. Note that you should perform an
+ * EXAMINE command to obtain the UID of the next message to create and a
+ * SELECT to ensure you are creating the message in the OUTBOX. */
+ curl_easy_setopt(curl, CURLOPT_URL, "imap://imap.example.com/100");
+
+ /* In this case, we're using a callback function to specify the data. You
+ * could just use the CURLOPT_READDATA option to specify a FILE pointer to
+ * read from. */
+ curl_easy_setopt(curl, CURLOPT_READFUNCTION, payload_source);
+ curl_easy_setopt(curl, CURLOPT_READDATA, &upload_ctx);
+ curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
+
+ /* Perform the append */
+ res = curl_easy_perform(curl);
+
+ /* Check for errors */
+ if(res != CURLE_OK)
+ fprintf(stderr, "curl_easy_perform() failed: %s\n",
+ curl_easy_strerror(res));
+
+ /* Always cleanup */
+ curl_easy_cleanup(curl);
+ }
+
+ return (int)res;
+}
diff --git a/docs/examples/imap-copy.c b/docs/examples/imap-copy.c
new file mode 100644
index 00000000..fe2d91c1
--- /dev/null
+++ b/docs/examples/imap-copy.c
@@ -0,0 +1,65 @@
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+#include <stdio.h>
+#include <curl/curl.h>
+
+/* This is a simple example showing how to copy a mail from one mailbox folder
+ * to another using libcurl's IMAP capabilities.
+ *
+ * Note that this example requires libcurl 7.30.0 or above.
+ */
+
+int main(void)
+{
+ CURL *curl;
+ CURLcode res = CURLE_OK;
+
+ 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 source mailbox folder to select */
+ curl_easy_setopt(curl, CURLOPT_URL, "imap://imap.example.com/INBOX");
+
+ /* Set the COPY command specifing the message ID and destination folder */
+ curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "COPY 1 FOLDER");
+
+ /* Note that to perform a move operation you will need to perform the copy,
+ * then mark the original mail as Deleted and EXPUNGE or CLOSE. Please see
+ * imap-store.c for more information on deleting messages. */
+
+ /* Perform the custom request */
+ res = curl_easy_perform(curl);
+
+ /* Check for errors */
+ if(res != CURLE_OK)
+ fprintf(stderr, "curl_easy_perform() failed: %s\n",
+ curl_easy_strerror(res));
+
+ /* Always cleanup */
+ curl_easy_cleanup(curl);
+ }
+
+ return (int)res;
+}
diff --git a/docs/examples/imap-create.c b/docs/examples/imap-create.c
new file mode 100644
index 00000000..65ddede6
--- /dev/null
+++ b/docs/examples/imap-create.c
@@ -0,0 +1,61 @@
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+#include <stdio.h>
+#include <curl/curl.h>
+
+/* This is a simple example showing how to create a new mailbox folder using
+ * libcurl's IMAP capabilities.
+ *
+ * Note that this example requires libcurl 7.30.0 or above.
+ */
+
+int main(void)
+{
+ CURL *curl;
+ CURLcode res = CURLE_OK;
+
+ 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 just the server URL */
+ curl_easy_setopt(curl, CURLOPT_URL, "imap://imap.example.com");
+
+ /* Set the CREATE command specifing the new folder name */
+ curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "CREATE FOLDER");
+
+ /* Perform the custom request */
+ res = curl_easy_perform(curl);
+
+ /* Check for errors */
+ if(res != CURLE_OK)
+ fprintf(stderr, "curl_easy_perform() failed: %s\n",
+ curl_easy_strerror(res));
+
+ /* Always cleanup */
+ curl_easy_cleanup(curl);
+ }
+
+ return (int)res;
+}
diff --git a/docs/examples/imap-delete.c b/docs/examples/imap-delete.c
new file mode 100644
index 00000000..5113be9a
--- /dev/null
+++ b/docs/examples/imap-delete.c
@@ -0,0 +1,61 @@
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+#include <stdio.h>
+#include <curl/curl.h>
+
+/* This is a simple example showing how to delete an existing mailbox folder
+ * using libcurl's IMAP capabilities.
+ *
+ * Note that this example requires libcurl 7.30.0 or above.
+ */
+
+int main(void)
+{
+ CURL *curl;
+ CURLcode res = CURLE_OK;
+
+ 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 just the server URL */
+ curl_easy_setopt(curl, CURLOPT_URL, "imap://imap.example.com");
+
+ /* Set the DELETE command specifing the existing folder */
+ curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "DELETE FOLDER");
+
+ /* Perform the custom request */
+ res = curl_easy_perform(curl);
+
+ /* Check for errors */
+ if(res != CURLE_OK)
+ fprintf(stderr, "curl_easy_perform() failed: %s\n",
+ curl_easy_strerror(res));
+
+ /* Always cleanup */
+ curl_easy_cleanup(curl);
+ }
+
+ return (int)res;
+}
diff --git a/docs/examples/imap-examine.c b/docs/examples/imap-examine.c
new file mode 100644
index 00000000..a7b41c58
--- /dev/null
+++ b/docs/examples/imap-examine.c
@@ -0,0 +1,61 @@
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+#include <stdio.h>
+#include <curl/curl.h>
+
+/* This is a simple example showing how to obtain information about a mailbox
+ * folder using libcurl's IMAP capabilities via the EXAMINE command.
+ *
+ * Note that this example requires libcurl 7.30.0 or above.
+ */
+
+int main(void)
+{
+ CURL *curl;
+ CURLcode res = CURLE_OK;
+
+ 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 just the server URL */
+ curl_easy_setopt(curl, CURLOPT_URL, "imap://imap.example.com");
+
+ /* Set the EXAMINE command specifing the mailbox folder */
+ curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "EXAMINE OUTBOX");
+
+ /* Perform the custom request */
+ res = curl_easy_perform(curl);
+
+ /* Check for errors */
+ if(res != CURLE_OK)
+ fprintf(stderr, "curl_easy_perform() failed: %s\n",
+ curl_easy_strerror(res));
+
+ /* Always cleanup */
+ curl_easy_cleanup(curl);
+ }
+
+ return (int)res;
+}
diff --git a/docs/examples/imap.c b/docs/examples/imap-fetch.c
index ba07f022..831d0dcf 100644
--- a/docs/examples/imap.c
+++ b/docs/examples/imap-fetch.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -22,6 +22,12 @@
#include <stdio.h>
#include <curl/curl.h>
+/* This is a simple example showing how to fetch mail using libcurl's IMAP
+ * capabilities.
+ *
+ * Note that this example requires libcurl 7.30.0 or above.
+ */
+
int main(void)
{
CURL *curl;
@@ -30,15 +36,23 @@ int main(void)
curl = curl_easy_init();
if(curl) {
/* Set username and password */
- curl_easy_setopt(curl, CURLOPT_USERPWD, "user:password");
+ curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
+ curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
- /* This will fetch the mailbox named "foobar" */
- curl_easy_setopt(curl, CURLOPT_URL, "imap://imap.example.com/foobar");
+ /* This will fetch message 1 from the user's inbox */
+ curl_easy_setopt(curl, CURLOPT_URL, "imap://imap.example.com/INBOX/;UID=1");
+ /* Perform the fetch */
res = curl_easy_perform(curl);
- /* always cleanup */
+ /* Check for errors */
+ if(res != CURLE_OK)
+ fprintf(stderr, "curl_easy_perform() failed: %s\n",
+ curl_easy_strerror(res));
+
+ /* Always cleanup */
curl_easy_cleanup(curl);
}
+
return (int)res;
}
diff --git a/docs/examples/imap-list.c b/docs/examples/imap-list.c
new file mode 100644
index 00000000..4223052e
--- /dev/null
+++ b/docs/examples/imap-list.c
@@ -0,0 +1,60 @@
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+#include <stdio.h>
+#include <curl/curl.h>
+
+/* This is a simple example showing how to list the folders within an IMAP
+ * mailbox.
+ *
+ * Note that this example requires libcurl 7.30.0 or above.
+ */
+
+int main(void)
+{
+ CURL *curl;
+ CURLcode res = CURLE_OK;
+
+ 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 will list the folders within the user's mailbox. If you want to
+ * list the folders within a specific folder, for example the inbox, then
+ * specify the folder as a path in the URL such as /INBOX */
+ curl_easy_setopt(curl, CURLOPT_URL, "imap://imap.example.com");
+
+ /* Perform the list */
+ res = curl_easy_perform(curl);
+
+ /* Check for errors */
+ if(res != CURLE_OK)
+ fprintf(stderr, "curl_easy_perform() failed: %s\n",
+ curl_easy_strerror(res));
+
+ /* Always cleanup */
+ curl_easy_cleanup(curl);
+ }
+
+ return (int)res;
+}
diff --git a/docs/examples/imap-multi.c b/docs/examples/imap-multi.c
new file mode 100644
index 00000000..601205a0
--- /dev/null
+++ b/docs/examples/imap-multi.c
@@ -0,0 +1,145 @@
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+#include <stdio.h>
+#include <curl/curl.h>
+
+/* This is a simple example showing how to fetch mail using libcurl's IMAP
+ * capabilities. It builds on the imap-fetch.c example to demonstrate how to
+ * use libcurl's multi interface.
+ *
+ * Note that this example requires libcurl 7.30.0 or above.
+ */
+
+#define MULTI_PERFORM_HANG_TIMEOUT 60 * 1000
+
+static struct timeval tvnow(void)
+{
+ struct timeval now;
+
+ /* time() returns the value of time in seconds since the epoch */
+ now.tv_sec = (long)time(NULL);
+ now.tv_usec = 0;
+
+ return now;
+}
+
+static long tvdiff(struct timeval newer, struct timeval older)
+{
+ return (newer.tv_sec - older.tv_sec) * 1000 +
+ (newer.tv_usec - older.tv_usec) / 1000;
+}
+
+int main(void)
+{
+ CURL *curl;
+ CURLM *mcurl;
+ int still_running = 1;
+ struct timeval mp_start;
+
+ curl_global_init(CURL_GLOBAL_DEFAULT);
+
+ curl = curl_easy_init();
+ if(!curl)
+ return 1;
+
+ mcurl = curl_multi_init();
+ if(!mcurl)
+ return 2;
+
+ /* Set username and password */
+ curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
+ curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
+
+ /* This will fetch message 1 from the user's inbox */
+ curl_easy_setopt(curl, CURLOPT_URL, "imap://imap.example.com/INBOX/;UID=1");
+
+ /* Tell the multi stack about our easy handle */
+ curl_multi_add_handle(mcurl, curl);
+
+ /* Record the start time which we can use later */
+ mp_start = tvnow();
+
+ /* We start some action by calling perform right away */
+ curl_multi_perform(mcurl, &still_running);
+
+ while(still_running) {
+ struct timeval timeout;
+ fd_set fdread;
+ fd_set fdwrite;
+ fd_set fdexcep;
+ int maxfd = -1;
+ int rc;
+
+ long curl_timeo = -1;
+
+ /* Initialise the file descriptors */
+ FD_ZERO(&fdread);
+ FD_ZERO(&fdwrite);
+ FD_ZERO(&fdexcep);
+
+ /* Set a suitable timeout to play around with */
+ timeout.tv_sec = 1;
+ timeout.tv_usec = 0;
+
+ curl_multi_timeout(mcurl, &curl_timeo);
+ if(curl_timeo >= 0) {
+ timeout.tv_sec = curl_timeo / 1000;
+ if(timeout.tv_sec > 1)
+ timeout.tv_sec = 1;
+ else
+ timeout.tv_usec = (curl_timeo % 1000) * 1000;
+ }
+
+ /* Get file descriptors from the transfers */
+ curl_multi_fdset(mcurl, &fdread, &fdwrite, &fdexcep, &maxfd);
+
+ /* In a real-world program you OF COURSE check the return code of the
+ function calls. On success, the value of maxfd is guaranteed to be
+ greater or equal than -1. We call select(maxfd + 1, ...), specially in
+ case of (maxfd == -1), we call select(0, ...), which is basically equal
+ to sleep. */
+ rc = select(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout);
+
+ if(tvdiff(tvnow(), mp_start) > MULTI_PERFORM_HANG_TIMEOUT) {
+ fprintf(stderr,
+ "ABORTING: Since it seems that we would have run forever.\n");
+ break;
+ }
+
+ switch(rc) {
+ case -1: /* select error */
+ break;
+ case 0: /* timeout */
+ default: /* action */
+ curl_multi_perform(mcurl, &still_running);
+ break;
+ }
+ }
+
+ /* Always cleanup */
+ curl_multi_remove_handle(mcurl, curl);
+ curl_multi_cleanup(mcurl);
+ curl_easy_cleanup(curl);
+ curl_global_cleanup();
+
+ return 0;
+}
diff --git a/docs/examples/imap-noop.c b/docs/examples/imap-noop.c
new file mode 100644
index 00000000..71a55728
--- /dev/null
+++ b/docs/examples/imap-noop.c
@@ -0,0 +1,61 @@
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+#include <stdio.h>
+#include <curl/curl.h>
+
+/* This is a simple example showing how to perform a noop using libcurl's IMAP
+ * capabilities.
+ *
+ * Note that this example requires libcurl 7.30.0 or above.
+ */
+
+int main(void)
+{
+ CURL *curl;
+ CURLcode res = CURLE_OK;
+
+ 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 just the server URL */
+ curl_easy_setopt(curl, CURLOPT_URL, "imap://imap.example.com");
+
+ /* Set the NOOP command */
+ curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "NOOP");
+
+ /* Perform the custom request */
+ res = curl_easy_perform(curl);
+
+ /* Check for errors */
+ if(res != CURLE_OK)
+ fprintf(stderr, "curl_easy_perform() failed: %s\n",
+ curl_easy_strerror(res));
+
+ /* Always cleanup */
+ curl_easy_cleanup(curl);
+ }
+
+ return (int)res;
+}
diff --git a/docs/examples/imap-search.c b/docs/examples/imap-search.c
new file mode 100644
index 00000000..0c1d2673
--- /dev/null
+++ b/docs/examples/imap-search.c
@@ -0,0 +1,65 @@
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+#include <stdio.h>
+#include <curl/curl.h>
+
+/* This is a simple example showing how to search for new messages using
+ * libcurl's IMAP capabilities.
+ *
+ * Note that this example requires libcurl 7.30.0 or above.
+ */
+
+int main(void)
+{
+ CURL *curl;
+ CURLcode res = CURLE_OK;
+
+ 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 mailbox folder to select */
+ curl_easy_setopt(curl, CURLOPT_URL, "imap://imap.example.com/INBOX");
+
+ /* Set the SEARCH command specifing what we want to search for. Note that
+ * this can contain a message sequence set and a number of search criteria
+ * keywords including flags such as ANSWERED, DELETED, DRAFT, FLAGGED, NEW,
+ * RECENT and SEEN. For more information about the search criteria please
+ * see RFC-3501 section 6.4.4. */
+ curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "SEARCH NEW");
+
+ /* Perform the custom request */
+ res = curl_easy_perform(curl);
+
+ /* Check for errors */
+ if(res != CURLE_OK)
+ fprintf(stderr, "curl_easy_perform() failed: %s\n",
+ curl_easy_strerror(res));
+
+ /* Always cleanup */
+ curl_easy_cleanup(curl);
+ }
+
+ return (int)res;
+}
diff --git a/docs/examples/pop3slist.c b/docs/examples/imap-ssl.c
index 9d9668fa..e42ff392 100644
--- a/docs/examples/pop3slist.c
+++ b/docs/examples/imap-ssl.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -22,52 +22,64 @@
#include <stdio.h>
#include <curl/curl.h>
+/* This is a simple example showing how to fetch mail using libcurl's IMAP
+ * capabilities. It builds on the imap-fetch.c example adding transport
+ * security to protect the authentication details from being snooped.
+ *
+ * Note that this example requires libcurl 7.30.0 or above.
+ */
+
int main(void)
{
CURL *curl;
- CURLcode res;
+ CURLcode res = CURLE_OK;
curl = curl_easy_init();
if(curl) {
/* Set username and password */
- curl_easy_setopt(curl, CURLOPT_USERPWD, "user:password");
+ curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
+ curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
- /* This will list every message of the given mailbox */
- curl_easy_setopt(curl, CURLOPT_URL, "pop3s://user@pop.example.com/");
+ /* This will fetch message 1 from the user's inbox. Note the use of
+ * imaps:// rather than imap:// to request a SSL based connection. */
+ curl_easy_setopt(curl, CURLOPT_URL, "imaps://imap.example.com/INBOX/;UID=1");
-#ifdef SKIP_PEER_VERIFICATION
- /*
- * If you want to connect to a site who isn't using a certificate that is
+ /* If you want to connect to a site who isn't using a certificate that is
* signed by one of the certs in the CA bundle you have, you can skip the
* verification of the server's certificate. This makes the connection
* A LOT LESS SECURE.
*
* If you have a CA cert for the server stored someplace else than in the
* default bundle, then the CURLOPT_CAPATH option might come handy for
- * you.
- */
+ * you. */
+#ifdef SKIP_PEER_VERIFICATION
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
#endif
-#ifdef SKIP_HOSTNAME_VERFICATION
- /*
- * If the site you're connecting to uses a different host name that what
+ /* If the site you're connecting to uses a different host name that what
* they have mentioned in their server certificate's commonName (or
* subjectAltName) fields, libcurl will refuse to connect. You can skip
- * this check, but this will make the connection less secure.
- */
+ * this check, but this will make the connection less secure. */
+#ifdef SKIP_HOSTNAME_VERFICATION
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
#endif
- /* Perform the request, res will get the return code */
+ /* 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 */
+ curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
+
+ /* Perform the fetch */
res = curl_easy_perform(curl);
+
/* Check for errors */
if(res != CURLE_OK)
fprintf(stderr, "curl_easy_perform() failed: %s\n",
curl_easy_strerror(res));
- /* always cleanup */
+ /* Always cleanup */
curl_easy_cleanup(curl);
}
- return 0;
+
+ return (int)res;
}
diff --git a/docs/examples/imap-store.c b/docs/examples/imap-store.c
new file mode 100644
index 00000000..8f5e7d5b
--- /dev/null
+++ b/docs/examples/imap-store.c
@@ -0,0 +1,76 @@
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+#include <stdio.h>
+#include <curl/curl.h>
+
+/* This is a simple example showing how to modify an existing mail using
+ * libcurl's IMAP capabilities with the STORE command.
+ *
+ * Note that this example requires libcurl 7.30.0 or above.
+ */
+
+int main(void)
+{
+ CURL *curl;
+ CURLcode res = CURLE_OK;
+
+ 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 mailbox folder to select */
+ curl_easy_setopt(curl, CURLOPT_URL, "imap://imap.example.com/INBOX");
+
+ /* Set the STORE command with the Deleted flag for message 1. Note that
+ * you can use the STORE command to set other flags such as Seen, Answered,
+ * Flagged, Draft and Recent. */
+ curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "STORE 1 +Flags \\Deleted");
+
+ /* Perform the custom request */
+ res = curl_easy_perform(curl);
+
+ /* Check for errors */
+ if(res != CURLE_OK)
+ fprintf(stderr, "curl_easy_perform() failed: %s\n",
+ curl_easy_strerror(res));
+ else {
+ /* Set the EXPUNGE command, although you can use the CLOSE command if you
+ * don't want to know the result of the STORE */
+ curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "EXPUNGE");
+
+ /* Perform the second custom request */
+ res = curl_easy_perform(curl);
+
+ /* Check for errors */
+ if(res != CURLE_OK)
+ fprintf(stderr, "curl_easy_perform() failed: %s\n",
+ curl_easy_strerror(res));
+ }
+
+ /* Always cleanup */
+ curl_easy_cleanup(curl);
+ }
+
+ return (int)res;
+}
diff --git a/docs/examples/imap-tls.c b/docs/examples/imap-tls.c
new file mode 100644
index 00000000..c439864b
--- /dev/null
+++ b/docs/examples/imap-tls.c
@@ -0,0 +1,84 @@
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+#include <stdio.h>
+#include <curl/curl.h>
+
+/* This is a simple example showing how to fetch mail using libcurl's IMAP
+ * capabilities. It builds on the imap-fetch.c example adding transport
+ * security to protect the authentication details from being snooped.
+ *
+ * Note that this example requires libcurl 7.30.0 or above.
+ */
+
+int main(void)
+{
+ CURL *curl;
+ CURLcode res = CURLE_OK;
+
+ 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 will fetch message 1 from the user's inbox */
+ curl_easy_setopt(curl, CURLOPT_URL, "imap://imap.example.com/INBOX/;UID=1");
+
+ /* In this example, we'll start with a plain text connection, and upgrade
+ * to Transport Layer Security (TLS) using the STARTTLS command. Be careful
+ * of using CURLUSESSL_TRY here, because if TLS upgrade fails, the transfer
+ * will continue anyway - see the security discussion in the libcurl
+ * tutorial for more details. */
+ curl_easy_setopt(curl, CURLOPT_USE_SSL, (long)CURLUSESSL_ALL);
+
+ /* If your server doesn't have a valid certificate, then you can disable
+ * part of the Transport Layer Security protection by setting the
+ * CURLOPT_SSL_VERIFYPEER and CURLOPT_SSL_VERIFYHOST options to 0 (false).
+ * curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
+ * curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
+ * That is, in general, a bad idea. It is still better than sending your
+ * authentication details in plain text though.
+ * Instead, you should get the issuer certificate (or the host certificate
+ * if the certificate is self-signed) and add it to the set of certificates
+ * that are known to libcurl using CURLOPT_CAINFO and/or CURLOPT_CAPATH. See
+ * docs/SSLCERTS for more information. */
+ curl_easy_setopt(curl, CURLOPT_CAINFO, "/path/to/certificate.pem");
+
+ /* 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 */
+ curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
+
+ /* Perform the fetch */
+ res = curl_easy_perform(curl);
+
+ /* Check for errors */
+ if(res != CURLE_OK)
+ fprintf(stderr, "curl_easy_perform() failed: %s\n",
+ curl_easy_strerror(res));
+
+ /* Always cleanup */
+ curl_easy_cleanup(curl);
+ }
+
+ return (int)res;
+}
diff --git a/docs/examples/pop3-dele.c b/docs/examples/pop3-dele.c
new file mode 100644
index 00000000..fab598f0
--- /dev/null
+++ b/docs/examples/pop3-dele.c
@@ -0,0 +1,64 @@
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+#include <stdio.h>
+#include <curl/curl.h>
+
+/* This is a simple example showing how to delete an existing mail using
+ * libcurl's POP3 capabilities.
+ *
+ * Note that this example requires libcurl 7.26.0 or above.
+ */
+
+int main(void)
+{
+ CURL *curl;
+ CURLcode res = CURLE_OK;
+
+ curl = curl_easy_init();
+ if(curl) {
+ /* Set username and password */
+ curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
+ curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
+
+ /* You can specify the message either in the URL or DELE command */
+ curl_easy_setopt(curl, CURLOPT_URL, "pop3://pop.example.com/1");
+
+ /* Set the DELE command */
+ curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "DELE");
+
+ /* Do not perform a transfer as DELE returns no data */
+ curl_easy_setopt(curl, CURLOPT_NOBODY, 1L);
+
+ /* Perform the custom request */
+ res = curl_easy_perform(curl);
+
+ /* Check for errors */
+ if(res != CURLE_OK)
+ fprintf(stderr, "curl_easy_perform() failed: %s\n",
+ curl_easy_strerror(res));
+
+ /* Always cleanup */
+ curl_easy_cleanup(curl);
+ }
+
+ return (int)res;
+}
diff --git a/docs/examples/pop3-list.c b/docs/examples/pop3-list.c
new file mode 100644
index 00000000..aebcea6b
--- /dev/null
+++ b/docs/examples/pop3-list.c
@@ -0,0 +1,58 @@
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+#include <stdio.h>
+#include <curl/curl.h>
+
+/* This is a simple example using libcurl's POP3 capabilities to list the
+ * contents of a mailbox.
+ *
+ * Note that this example requires libcurl 7.20.0 or above.
+ */
+
+int main(void)
+{
+ CURL *curl;
+ CURLcode res = CURLE_OK;
+
+ 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 will list every message of the given mailbox */
+ curl_easy_setopt(curl, CURLOPT_URL, "pop3://pop.example.com");
+
+ /* Perform the list */
+ res = curl_easy_perform(curl);
+
+ /* Check for errors */
+ if(res != CURLE_OK)
+ fprintf(stderr, "curl_easy_perform() failed: %s\n",
+ curl_easy_strerror(res));
+
+ /* Always cleanup */
+ curl_easy_cleanup(curl);
+ }
+
+ return (int)res;
+}
diff --git a/docs/examples/pop3-multi.c b/docs/examples/pop3-multi.c
new file mode 100644
index 00000000..d14d1159
--- /dev/null
+++ b/docs/examples/pop3-multi.c
@@ -0,0 +1,145 @@
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+#include <stdio.h>
+#include <curl/curl.h>
+
+/* This is a simple example showing how to retrieve mail using libcurl's POP3
+ * capabilities. It builds on the pop3-retr.c example to demonstrate how to use
+ * libcurl's multi interface.
+ *
+ * Note that this example requires libcurl 7.20.0 or above.
+ */
+
+#define MULTI_PERFORM_HANG_TIMEOUT 60 * 1000
+
+static struct timeval tvnow(void)
+{
+ struct timeval now;
+
+ /* time() returns the value of time in seconds since the epoch */
+ now.tv_sec = (long)time(NULL);
+ now.tv_usec = 0;
+
+ return now;
+}
+
+static long tvdiff(struct timeval newer, struct timeval older)
+{
+ return (newer.tv_sec - older.tv_sec) * 1000 +
+ (newer.tv_usec - older.tv_usec) / 1000;
+}
+
+int main(void)
+{
+ CURL *curl;
+ CURLM *mcurl;
+ int still_running = 1;
+ struct timeval mp_start;
+
+ curl_global_init(CURL_GLOBAL_DEFAULT);
+
+ curl = curl_easy_init();
+ if(!curl)
+ return 1;
+
+ mcurl = curl_multi_init();
+ if(!mcurl)
+ return 2;
+
+ /* Set username and password */
+ curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
+ curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
+
+ /* This will retreive message 1 from the user's mailbox */
+ curl_easy_setopt(curl, CURLOPT_URL, "pop3://pop.example.com/1");
+
+ /* Tell the multi stack about our easy handle */
+ curl_multi_add_handle(mcurl, curl);
+
+ /* Record the start time which we can use later */
+ mp_start = tvnow();
+
+ /* We start some action by calling perform right away */
+ curl_multi_perform(mcurl, &still_running);
+
+ while(still_running) {
+ struct timeval timeout;
+ fd_set fdread;
+ fd_set fdwrite;
+ fd_set fdexcep;
+ int maxfd = -1;
+ int rc;
+
+ long curl_timeo = -1;
+
+ /* Initialise the file descriptors */
+ FD_ZERO(&fdread);
+ FD_ZERO(&fdwrite);
+ FD_ZERO(&fdexcep);
+
+ /* Set a suitable timeout to play around with */
+ timeout.tv_sec = 1;
+ timeout.tv_usec = 0;
+
+ curl_multi_timeout(mcurl, &curl_timeo);
+ if(curl_timeo >= 0) {
+ timeout.tv_sec = curl_timeo / 1000;
+ if(timeout.tv_sec > 1)
+ timeout.tv_sec = 1;
+ else
+ timeout.tv_usec = (curl_timeo % 1000) * 1000;
+ }
+
+ /* Get file descriptors from the transfers */
+ curl_multi_fdset(mcurl, &fdread, &fdwrite, &fdexcep, &maxfd);
+
+ /* In a real-world program you OF COURSE check the return code of the
+ function calls. On success, the value of maxfd is guaranteed to be
+ greater or equal than -1. We call select(maxfd + 1, ...), specially in
+ case of (maxfd == -1), we call select(0, ...), which is basically equal
+ to sleep. */
+ rc = select(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout);
+
+ if(tvdiff(tvnow(), mp_start) > MULTI_PERFORM_HANG_TIMEOUT) {
+ fprintf(stderr,
+ "ABORTING: Since it seems that we would have run forever.\n");
+ break;
+ }
+
+ switch(rc) {
+ case -1: /* select error */
+ break;
+ case 0: /* timeout */
+ default: /* action */
+ curl_multi_perform(mcurl, &still_running);
+ break;
+ }
+ }
+
+ /* Always cleanup */
+ curl_multi_remove_handle(mcurl, curl);
+ curl_multi_cleanup(mcurl);
+ curl_easy_cleanup(curl);
+ curl_global_cleanup();
+
+ return 0;
+}
diff --git a/docs/examples/pop3-noop.c b/docs/examples/pop3-noop.c
new file mode 100644
index 00000000..4efe6715
--- /dev/null
+++ b/docs/examples/pop3-noop.c
@@ -0,0 +1,64 @@
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+#include <stdio.h>
+#include <curl/curl.h>
+
+/* This is a simple example showing how to perform a noop using libcurl's POP3
+ * capabilities.
+ *
+ * Note that this example requires libcurl 7.26.0 or above.
+ */
+
+int main(void)
+{
+ CURL *curl;
+ CURLcode res = CURLE_OK;
+
+ 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 just the server URL */
+ curl_easy_setopt(curl, CURLOPT_URL, "pop3://pop.example.com");
+
+ /* Set the NOOP command */
+ curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "NOOP");
+
+ /* Do not perform a transfer as NOOP returns no data */
+ curl_easy_setopt(curl, CURLOPT_NOBODY, 1L);
+
+ /* Perform the custom request */
+ res = curl_easy_perform(curl);
+
+ /* Check for errors */
+ if(res != CURLE_OK)
+ fprintf(stderr, "curl_easy_perform() failed: %s\n",
+ curl_easy_strerror(res));
+
+ /* Always cleanup */
+ curl_easy_cleanup(curl);
+ }
+
+ return (int)res;
+}
diff --git a/docs/examples/pop3-retr.c b/docs/examples/pop3-retr.c
new file mode 100644
index 00000000..e5a50f22
--- /dev/null
+++ b/docs/examples/pop3-retr.c
@@ -0,0 +1,58 @@
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+#include <stdio.h>
+#include <curl/curl.h>
+
+/* This is a simple example showing how to retrieve mail using libcurl's POP3
+ * capabilities.
+ *
+ * Note that this example requires libcurl 7.20.0 or above.
+ */
+
+int main(void)
+{
+ CURL *curl;
+ CURLcode res = CURLE_OK;
+
+ 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 will retreive message 1 from the user's mailbox */
+ curl_easy_setopt(curl, CURLOPT_URL, "pop3://pop.example.com/1");
+
+ /* Perform the retr */
+ res = curl_easy_perform(curl);
+
+ /* Check for errors */
+ if(res != CURLE_OK)
+ fprintf(stderr, "curl_easy_perform() failed: %s\n",
+ curl_easy_strerror(res));
+
+ /* Always cleanup */
+ curl_easy_cleanup(curl);
+ }
+
+ return (int)res;
+}
diff --git a/docs/examples/pop3s.c b/docs/examples/pop3-ssl.c
index 44d7c80d..45e0054b 100644
--- a/docs/examples/pop3s.c
+++ b/docs/examples/pop3-ssl.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -22,52 +22,64 @@
#include <stdio.h>
#include <curl/curl.h>
+/* This is a simple example showing how to retrieve mail using libcurl's POP3
+ * capabilities. It builds on the pop3-retr.c example adding transport
+ * security to protect the authentication details from being snooped.
+ *
+ * Note that this example requires libcurl 7.20.0 or above.
+ */
+
int main(void)
{
CURL *curl;
- CURLcode res;
+ CURLcode res = CURLE_OK;
curl = curl_easy_init();
if(curl) {
/* Set username and password */
- curl_easy_setopt(curl, CURLOPT_USERPWD, "user:password");
+ curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
+ curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
- /* This will only fetch the message with ID "1" of the given mailbox */
- curl_easy_setopt(curl, CURLOPT_URL, "pop3s://user@pop.example.com/1");
+ /* This will retreive message 1 from the user's mailbox. Note the use of
+ * pop3s:// rather than pop3:// to request a SSL based connection. */
+ curl_easy_setopt(curl, CURLOPT_URL, "pop3s://pop.example.com/1");
-#ifdef SKIP_PEER_VERIFICATION
- /*
- * If you want to connect to a site who isn't using a certificate that is
+ /* If you want to connect to a site who isn't using a certificate that is
* signed by one of the certs in the CA bundle you have, you can skip the
* verification of the server's certificate. This makes the connection
* A LOT LESS SECURE.
*
* If you have a CA cert for the server stored someplace else than in the
* default bundle, then the CURLOPT_CAPATH option might come handy for
- * you.
- */
+ * you. */
+#ifdef SKIP_PEER_VERIFICATION
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
#endif
-#ifdef SKIP_HOSTNAME_VERFICATION
- /*
- * If the site you're connecting to uses a different host name that what
+ /* If the site you're connecting to uses a different host name that what
* they have mentioned in their server certificate's commonName (or
* subjectAltName) fields, libcurl will refuse to connect. You can skip
- * this check, but this will make the connection less secure.
- */
+ * this check, but this will make the connection less secure. */
+#ifdef SKIP_HOSTNAME_VERFICATION
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
#endif
- /* Perform the request, res will get the return code */
+ /* 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 */
+ curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
+
+ /* Perform the retr */
res = curl_easy_perform(curl);
+
/* Check for errors */
if(res != CURLE_OK)
fprintf(stderr, "curl_easy_perform() failed: %s\n",
curl_easy_strerror(res));
- /* always cleanup */
+ /* Always cleanup */
curl_easy_cleanup(curl);
}
- return 0;
+
+ return (int)res;
}
diff --git a/docs/examples/pop3-stat.c b/docs/examples/pop3-stat.c
new file mode 100644
index 00000000..7b318fc2
--- /dev/null
+++ b/docs/examples/pop3-stat.c
@@ -0,0 +1,64 @@
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+#include <stdio.h>
+#include <curl/curl.h>
+
+/* This is a simple example showing how to obtain message statistics using
+ * libcurl's POP3 capabilities.
+ *
+ * Note that this example requires libcurl 7.26.0 or above.
+ */
+
+int main(void)
+{
+ CURL *curl;
+ CURLcode res = CURLE_OK;
+
+ 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 just the server URL */
+ curl_easy_setopt(curl, CURLOPT_URL, "pop3://pop.example.com");
+
+ /* Set the STAT command */
+ curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "STAT");
+
+ /* Do not perform a transfer as the data is in the response */
+ curl_easy_setopt(curl, CURLOPT_NOBODY, 1L);
+
+ /* Perform the custom request */
+ res = curl_easy_perform(curl);
+
+ /* Check for errors */
+ if(res != CURLE_OK)
+ fprintf(stderr, "curl_easy_perform() failed: %s\n",
+ curl_easy_strerror(res));
+
+ /* Always cleanup */
+ curl_easy_cleanup(curl);
+ }
+
+ return (int)res;
+}
diff --git a/docs/examples/pop3-tls.c b/docs/examples/pop3-tls.c
new file mode 100644
index 00000000..812d89b8
--- /dev/null
+++ b/docs/examples/pop3-tls.c
@@ -0,0 +1,84 @@
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+#include <stdio.h>
+#include <curl/curl.h>
+
+/* This is a simple example showing how to retrieve mail using libcurl's POP3
+ * capabilities. It builds on the pop3-retr.c example adding transport
+ * security to protect the authentication details from being snooped.
+ *
+ * Note that this example requires libcurl 7.20.0 or above.
+ */
+
+int main(void)
+{
+ CURL *curl;
+ CURLcode res = CURLE_OK;
+
+ 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 will retreive message 1 from the user's mailbox */
+ curl_easy_setopt(curl, CURLOPT_URL, "pop3://pop.example.com/1");
+
+ /* In this example, we'll start with a plain text connection, and upgrade
+ * to Transport Layer Security (TLS) using the STLS command. Be careful of
+ * using CURLUSESSL_TRY here, because if TLS upgrade fails, the transfer
+ * will continue anyway - see the security discussion in the libcurl
+ * tutorial for more details. */
+ curl_easy_setopt(curl, CURLOPT_USE_SSL, (long)CURLUSESSL_ALL);
+
+ /* If your server doesn't have a valid certificate, then you can disable
+ * part of the Transport Layer Security protection by setting the
+ * CURLOPT_SSL_VERIFYPEER and CURLOPT_SSL_VERIFYHOST options to 0 (false).
+ * curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
+ * curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
+ * That is, in general, a bad idea. It is still better than sending your
+ * authentication details in plain text though.
+ * Instead, you should get the issuer certificate (or the host certificate
+ * if the certificate is self-signed) and add it to the set of certificates
+ * that are known to libcurl using CURLOPT_CAINFO and/or CURLOPT_CAPATH. See
+ * docs/SSLCERTS for more information. */
+ curl_easy_setopt(curl, CURLOPT_CAINFO, "/path/to/certificate.pem");
+
+ /* 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 */
+ curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
+
+ /* Perform the retr */
+ res = curl_easy_perform(curl);
+
+ /* Check for errors */
+ if(res != CURLE_OK)
+ fprintf(stderr, "curl_easy_perform() failed: %s\n",
+ curl_easy_strerror(res));
+
+ /* Always cleanup */
+ curl_easy_cleanup(curl);
+ }
+
+ return (int)res;
+}
diff --git a/docs/examples/pop3-top.c b/docs/examples/pop3-top.c
new file mode 100644
index 00000000..21cee889
--- /dev/null
+++ b/docs/examples/pop3-top.c
@@ -0,0 +1,61 @@
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+#include <stdio.h>
+#include <curl/curl.h>
+
+/* This is a simple example showing how to retrieve only the headers of a mail
+ * using libcurl's POP3 capabilities.
+ *
+ * Note that this example requires libcurl 7.26.0 or above.
+ */
+
+int main(void)
+{
+ CURL *curl;
+ CURLcode res = CURLE_OK;
+
+ 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 just the server URL */
+ curl_easy_setopt(curl, CURLOPT_URL, "pop3://pop.example.com");
+
+ /* Set the TOP command for message 1 to only include the headers */
+ curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "TOP 1 0");
+
+ /* Perform the custom request */
+ res = curl_easy_perform(curl);
+
+ /* Check for errors */
+ if(res != CURLE_OK)
+ fprintf(stderr, "curl_easy_perform() failed: %s\n",
+ curl_easy_strerror(res));
+
+ /* Always cleanup */
+ curl_easy_cleanup(curl);
+ }
+
+ return (int)res;
+}
diff --git a/docs/examples/pop3-uidl.c b/docs/examples/pop3-uidl.c
new file mode 100644
index 00000000..debb1791
--- /dev/null
+++ b/docs/examples/pop3-uidl.c
@@ -0,0 +1,61 @@
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+#include <stdio.h>
+#include <curl/curl.h>
+
+/* This is a simple example using libcurl's POP3 capabilities to list the
+ * contents of a mailbox by unique ID.
+ *
+ * Note that this example requires libcurl 7.26.0 or above.
+ */
+
+int main(void)
+{
+ CURL *curl;
+ CURLcode res = CURLE_OK;
+
+ 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 just the server URL */
+ curl_easy_setopt(curl, CURLOPT_URL, "pop3://pop.example.com");
+
+ /* Set the UIDL command */
+ curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "UIDL");
+
+ /* Perform the custom request */
+ res = curl_easy_perform(curl);
+
+ /* Check for errors */
+ if(res != CURLE_OK)
+ fprintf(stderr, "curl_easy_perform() failed: %s\n",
+ curl_easy_strerror(res));
+
+ /* Always cleanup */
+ curl_easy_cleanup(curl);
+ }
+
+ return (int)res;
+}
diff --git a/docs/examples/simplesmtp.c b/docs/examples/simplesmtp.c
deleted file mode 100644
index df851624..00000000
--- a/docs/examples/simplesmtp.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
- *
- * This software is licensed as described in the file COPYING, which
- * you should have received as part of this distribution. The terms
- * are also available at http://curl.haxx.se/docs/copyright.html.
- *
- * You may opt to use, copy, modify, merge, publish, distribute and/or sell
- * copies of the Software, and permit persons to whom the Software is
- * furnished to do so, under the terms of the COPYING file.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ***************************************************************************/
-#include <stdio.h>
-#include <string.h>
-#include <curl/curl.h>
-
-int main(void)
-{
- CURL *curl;
- CURLcode res;
- struct curl_slist *recipients = NULL;
-
- /* value for envelope reverse-path */
- static const char *from = "<bradh@example.com>";
-
- /* this becomes the envelope forward-path */
- static const char *to = "<bradh@example.net>";
-
- curl = curl_easy_init();
- if(curl) {
- /* this is the URL for your mailserver - you can also use an smtps:// URL
- * here */
- curl_easy_setopt(curl, CURLOPT_URL, "smtp://mail.example.net.");
-
- /* Note that this option isn't strictly required, omitting it will result in
- * libcurl will sent the MAIL FROM command with no sender data. All
- * autoresponses should have an empty reverse-path, and should be directed
- * to the address in the reverse-path which triggered them. Otherwise, they
- * could cause an endless loop. See RFC 5321 Section 4.5.5 for more details.
- */
- curl_easy_setopt(curl, CURLOPT_MAIL_FROM, from);
-
- /* Note that the CURLOPT_MAIL_RCPT takes a list, not a char array. */
- recipients = curl_slist_append(recipients, to);
- curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients);
-
- /* You provide the payload (headers and the body of the message) as the
- * "data" element. There are two choices, either:
- * - provide a callback function and specify the function name using the
- * CURLOPT_READFUNCTION option; or
- * - just provide a FILE pointer that can be used to read the data from.
- * The easiest case is just to read from standard input, (which is available
- * as a FILE pointer) as shown here.
- */
- curl_easy_setopt(curl, CURLOPT_READDATA, stdin);
-
- /* send the message (including headers) */
- res = curl_easy_perform(curl);
- /* Check for errors */
- if(res != CURLE_OK)
- fprintf(stderr, "curl_easy_perform() failed: %s\n",
- curl_easy_strerror(res));
-
- /* free the list of recipients */
- curl_slist_free_all(recipients);
-
- /* curl won't send the QUIT command until you call cleanup, so you should be
- * able to re-use this connection for additional messages (setting
- * CURLOPT_MAIL_FROM and CURLOPT_MAIL_RCPT as required, and calling
- * curl_easy_perform() again. It may not be a good idea to keep the
- * connection open for a very long time though (more than a few minutes may
- * result in the server timing out the connection), and you do want to clean
- * up in the end.
- */
- curl_easy_cleanup(curl);
- }
- return 0;
-}
diff --git a/docs/examples/smtp-expn.c b/docs/examples/smtp-expn.c
new file mode 100644
index 00000000..0322d2fc
--- /dev/null
+++ b/docs/examples/smtp-expn.c
@@ -0,0 +1,73 @@
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+#include <stdio.h>
+#include <string.h>
+#include <curl/curl.h>
+
+/* This is a simple example showing how to expand an email mailing list.
+ *
+ * Notes:
+ *
+ * 1) This example requires libcurl 7.34.0 or above.
+ * 2) Not all email servers support this command.
+ */
+
+int main(void)
+{
+ CURL *curl;
+ CURLcode res;
+ struct curl_slist *recipients = NULL;
+
+ curl = curl_easy_init();
+ if(curl) {
+ /* This is the URL for your mailserver */
+ curl_easy_setopt(curl, CURLOPT_URL, "smtp://mail.example.com");
+
+ /* Note that the CURLOPT_MAIL_RCPT takes a list, not a char array */
+ recipients = curl_slist_append(recipients, "Friends");
+ curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients);
+
+ /* Set the EXPN command */
+ curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "EXPN");
+
+ /* Perform the custom request */
+ res = curl_easy_perform(curl);
+
+ /* Check for errors */
+ if(res != CURLE_OK)
+ fprintf(stderr, "curl_easy_perform() failed: %s\n",
+ curl_easy_strerror(res));
+
+ /* Free the list of recipients */
+ curl_slist_free_all(recipients);
+
+ /* Curl won't send the QUIT command until you call cleanup, so you should
+ * be able to re-use this connection for additional requests. It may not be
+ * a good idea to keep the connection open for a very long time though
+ * (more than a few minutes may result in the server timing out the
+ * connection) and you do want to clean up in the end.
+ */
+ curl_easy_cleanup(curl);
+ }
+
+ return 0;
+}
diff --git a/docs/examples/smtp-mail.c b/docs/examples/smtp-mail.c
new file mode 100644
index 00000000..af4d1b65
--- /dev/null
+++ b/docs/examples/smtp-mail.c
@@ -0,0 +1,137 @@
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+#include <stdio.h>
+#include <string.h>
+#include <curl/curl.h>
+
+/* This is a simple example showing how to send mail using libcurl's SMTP
+ * capabilities. For an exmaple of using the multi interface please see
+ * smtp-multi.c.
+ *
+ * Note that this example requires libcurl 7.20.0 or above.
+ */
+
+#define FROM "<sender@example.org>"
+#define TO "<addressee@example.net>"
+#define CC "<info@example.org>"
+
+static const char *payload_text[] = {
+ "Date: Mon, 29 Nov 2010 21:54:29 +1100\r\n",
+ "To: " TO "\r\n",
+ "From: " FROM "(Example User)\r\n",
+ "Cc: " CC "(Another example User)\r\n",
+ "Message-ID: <dcd7cb36-11db-487a-9f3a-e652a9458efd@rfcpedant.example.org>\r\n",
+ "Subject: SMTP 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",
+ "It could be a lot of lines, could be MIME encoded, whatever.\r\n",
+ "Check RFC5322.\r\n",
+ NULL
+};
+
+struct upload_status {
+ int lines_read;
+};
+
+static size_t payload_source(void *ptr, size_t size, size_t nmemb, void *userp)
+{
+ struct upload_status *upload_ctx = (struct upload_status *)userp;
+ const char *data;
+
+ if((size == 0) || (nmemb == 0) || ((size*nmemb) < 1)) {
+ return 0;
+ }
+
+ data = payload_text[upload_ctx->lines_read];
+
+ if(data) {
+ size_t len = strlen(data);
+ memcpy(ptr, data, len);
+ upload_ctx->lines_read++;
+
+ return len;
+ }
+
+ return 0;
+}
+
+int main(void)
+{
+ CURL *curl;
+ CURLcode res = CURLE_OK;
+ struct curl_slist *recipients = NULL;
+ struct upload_status upload_ctx;
+
+ upload_ctx.lines_read = 0;
+
+ curl = curl_easy_init();
+ if(curl) {
+ /* This is the URL for your mailserver */
+ curl_easy_setopt(curl, CURLOPT_URL, "smtp://mail.example.com");
+
+ /* Note that this option isn't strictly required, omitting it will result in
+ * libcurl sending the MAIL FROM command with empty sender data. All
+ * autoresponses should have an empty reverse-path, and should be directed
+ * to the address in the reverse-path which triggered them. Otherwise, they
+ * could cause an endless loop. See RFC 5321 Section 4.5.5 for more details.
+ */
+ 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. */
+ recipients = curl_slist_append(recipients, TO);
+ recipients = curl_slist_append(recipients, CC);
+ curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients);
+
+ /* We're using a callback function to specify the payload (the headers and
+ * body of the message). You could just use the CURLOPT_READDATA option to
+ * specify a FILE pointer to read from. */
+ curl_easy_setopt(curl, CURLOPT_READFUNCTION, payload_source);
+ curl_easy_setopt(curl, CURLOPT_READDATA, &upload_ctx);
+ curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
+
+ /* Send the message */
+ res = curl_easy_perform(curl);
+
+ /* Check for errors */
+ if(res != CURLE_OK)
+ fprintf(stderr, "curl_easy_perform() failed: %s\n",
+ curl_easy_strerror(res));
+
+ /* Free the list of recipients */
+ curl_slist_free_all(recipients);
+
+ /* curl won't send the QUIT command until you call cleanup, so you should be
+ * able to re-use this connection for additional messages (setting
+ * CURLOPT_MAIL_FROM and CURLOPT_MAIL_RCPT as required, and calling
+ * curl_easy_perform() again. It may not be a good idea to keep the
+ * connection open for a very long time though (more than a few minutes may
+ * result in the server timing out the connection), and you do want to clean
+ * up in the end.
+ */
+ curl_easy_cleanup(curl);
+ }
+
+ return (int)res;
+}
diff --git a/docs/examples/smtp-multi.c b/docs/examples/smtp-multi.c
index 6462aff2..7f3d333d 100644
--- a/docs/examples/smtp-multi.c
+++ b/docs/examples/smtp-multi.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -19,139 +19,151 @@
* KIND, either express or implied.
*
***************************************************************************/
-/* This is an example application source code sending SMTP mail using the
- * multi interface.
- */
-
#include <string.h>
#include <curl/curl.h>
-/*
- * This is the list of basic details you need to tweak to get things right.
+/* This is an example showing how to send mail using libcurl's SMTP
+ * 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.
*/
-#define USERNAME "user@example.com"
-#define PASSWORD "123qwerty"
-#define SMTPSERVER "smtp.example.com"
-#define SMTPPORT ":587" /* it is a colon+port string, but you can set it
- to "" to use the default port */
-#define RECIPIENT "<recipient@example.com>"
-#define MAILFROM "<realuser@example.com>"
+
+#define FROM "<sender@example.com>"
+#define TO "<recipient@example.com>"
+#define CC "<info@example.com>"
#define MULTI_PERFORM_HANG_TIMEOUT 60 * 1000
-/* Note that you should include the actual meta data headers here as well if
- you want the mail to have a Subject, another From:, show a To: or whatever
- you think your mail should feature! */
-static const char *text[]={
- "one\n",
- "two\n",
- "three\n",
- " Hello, this is CURL email SMTP\n",
+static const char *payload_text[] = {
+ "Date: Mon, 29 Nov 2010 21:54:29 +1100\r\n",
+ "To: " TO "\r\n",
+ "From: " FROM "(Example User)\r\n",
+ "Cc: " CC "(Another example User)\r\n",
+ "Message-ID: <dcd7cb36-11db-487a-9f3a-e652a9458efd@rfcpedant.example.org>\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",
+ "It could be a lot of lines, could be MIME encoded, whatever.\r\n",
+ "Check RFC5322.\r\n",
NULL
};
-struct WriteThis {
- int counter;
+struct upload_status {
+ int lines_read;
};
-static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *userp)
+static size_t payload_source(void *ptr, size_t size, size_t nmemb, void *userp)
{
- struct WriteThis *pooh = (struct WriteThis *)userp;
+ struct upload_status *upload_ctx = (struct upload_status *)userp;
const char *data;
- if(size*nmemb < 1)
+ if((size == 0) || (nmemb == 0) || ((size*nmemb) < 1)) {
return 0;
+ }
- data = text[pooh->counter];
+ data = payload_text[upload_ctx->lines_read];
if(data) {
size_t len = strlen(data);
memcpy(ptr, data, len);
- pooh->counter++; /* advance pointer */
+ upload_ctx->lines_read++;
+
return len;
}
- return 0; /* no more data left to deliver */
+
+ return 0;
}
static struct timeval tvnow(void)
{
- /*
- ** time() returns the value of time in seconds since the Epoch.
- */
struct timeval now;
+
+ /* time() returns the value of time in seconds since the epoch */
now.tv_sec = (long)time(NULL);
now.tv_usec = 0;
+
return now;
}
static long tvdiff(struct timeval newer, struct timeval older)
{
- return (newer.tv_sec-older.tv_sec)*1000+
- (newer.tv_usec-older.tv_usec)/1000;
+ return (newer.tv_sec - older.tv_sec) * 1000 +
+ (newer.tv_usec - older.tv_usec) / 1000;
}
int main(void)
{
- CURL *curl;
- CURLM *mcurl;
- int still_running = 1;
- struct timeval mp_start;
- struct WriteThis pooh;
- struct curl_slist* rcpt_list = NULL;
+ CURL *curl;
+ CURLM *mcurl;
+ int still_running = 1;
+ struct timeval mp_start;
+ struct curl_slist *recipients = NULL;
+ struct upload_status upload_ctx;
+
+ upload_ctx.lines_read = 0;
- pooh.counter = 0;
+ curl_global_init(CURL_GLOBAL_DEFAULT);
- curl_global_init(CURL_GLOBAL_DEFAULT);
+ curl = curl_easy_init();
+ if(!curl)
+ return 1;
- curl = curl_easy_init();
- if(!curl)
- return 1;
+ mcurl = curl_multi_init();
+ if(!mcurl)
+ return 2;
- mcurl = curl_multi_init();
- if(!mcurl)
- return 2;
+ /* This is the URL for your mailserver */
+ curl_easy_setopt(curl, CURLOPT_URL, "smtp://mail.example.com");
- rcpt_list = curl_slist_append(rcpt_list, RECIPIENT);
- /* more addresses can be added here
- rcpt_list = curl_slist_append(rcpt_list, "<others@example.com>");
+ /* Note that this option isn't strictly required, omitting it will result in
+ * libcurl sending the MAIL FROM command with empty sender data. All
+ * autoresponses should have an empty reverse-path, and should be directed
+ * to the address in the reverse-path which triggered them. Otherwise, they
+ * could cause an endless loop. See RFC 5321 Section 4.5.5 for more details.
*/
+ curl_easy_setopt(curl, CURLOPT_MAIL_FROM, FROM);
- curl_easy_setopt(curl, CURLOPT_URL, "smtp://" SMTPSERVER SMTPPORT);
- 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_MAIL_FROM, MAILFROM);
- curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, rcpt_list);
- 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_READDATA, &pooh);
- 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();
-
- /* we start some action by calling perform right away */
+ /* 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. */
+ recipients = curl_slist_append(recipients, TO);
+ recipients = curl_slist_append(recipients, CC);
+ curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients);
+
+ /* We're using a callback function to specify the payload (the headers and
+ * body of the message). You could just use the CURLOPT_READDATA option to
+ * specify a FILE pointer to read from. */
+ curl_easy_setopt(curl, CURLOPT_READFUNCTION, payload_source);
+ curl_easy_setopt(curl, CURLOPT_READDATA, &upload_ctx);
+ curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
+
+ /* Tell the multi stack about our easy handle */
+ curl_multi_add_handle(mcurl, curl);
+
+ /* Record the start time which we can use later */
+ mp_start = tvnow();
+
+ /* We start some action by calling perform right away */
curl_multi_perform(mcurl, &still_running);
while(still_running) {
struct timeval timeout;
- int rc; /* select() return code */
-
fd_set fdread;
fd_set fdwrite;
fd_set fdexcep;
int maxfd = -1;
+ int rc;
long curl_timeo = -1;
+ /* Initialise the file descriptors */
FD_ZERO(&fdread);
FD_ZERO(&fdwrite);
FD_ZERO(&fdexcep);
- /* set a suitable timeout to play around with */
+ /* Set a suitable timeout to play around with */
timeout.tv_sec = 1;
timeout.tv_usec = 0;
@@ -164,7 +176,7 @@ int main(void)
timeout.tv_usec = (curl_timeo % 1000) * 1000;
}
- /* get file descriptors from the transfers */
+ /* Get file descriptors from the transfers */
curl_multi_fdset(mcurl, &fdread, &fdwrite, &fdexcep, &maxfd);
/* In a real-world program you OF COURSE check the return code of the
@@ -172,32 +184,32 @@ int main(void)
greater or equal than -1. We call select(maxfd + 1, ...), specially in
case of (maxfd == -1), we call select(0, ...), which is basically equal
to sleep. */
-
rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
- if (tvdiff(tvnow(), mp_start) > MULTI_PERFORM_HANG_TIMEOUT) {
- fprintf(stderr, "ABORTING TEST, since it seems "
- "that it would have run forever.\n");
+ if(tvdiff(tvnow(), mp_start) > MULTI_PERFORM_HANG_TIMEOUT) {
+ fprintf(stderr,
+ "ABORTING: Since it seems that we would have run forever.\n");
break;
}
switch(rc) {
- case -1:
- /* select error */
+ case -1: /* select error */
break;
- case 0: /* timeout */
- default: /* action */
+ case 0: /* timeout */
+ default: /* action */
curl_multi_perform(mcurl, &still_running);
break;
}
}
- curl_slist_free_all(rcpt_list);
+ /* Free the list of recipients */
+ curl_slist_free_all(recipients);
+
+ /* Always cleanup */
curl_multi_remove_handle(mcurl, curl);
curl_multi_cleanup(mcurl);
curl_easy_cleanup(curl);
curl_global_cleanup();
+
return 0;
}
-
-
diff --git a/docs/examples/smtp-ssl.c b/docs/examples/smtp-ssl.c
new file mode 100644
index 00000000..9a68a7ff
--- /dev/null
+++ b/docs/examples/smtp-ssl.c
@@ -0,0 +1,161 @@
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+#include <stdio.h>
+#include <string.h>
+#include <curl/curl.h>
+
+/* This is a simple example showing how to send mail using libcurl's SMTP
+ * capabilities. It builds on the smtp-mail.c example to add authentication
+ * and, more importantly, transport security to protect the authentication
+ * details from being snooped.
+ *
+ * Note that this example requires libcurl 7.20.0 or above.
+ */
+
+#define FROM "<sender@example.org>"
+#define TO "<addressee@example.net>"
+#define CC "<info@example.org>"
+
+static const char *payload_text[] = {
+ "Date: Mon, 29 Nov 2010 21:54:29 +1100\r\n",
+ "To: " TO "\r\n",
+ "From: " FROM "(Example User)\r\n",
+ "Cc: " CC "(Another example User)\r\n",
+ "Message-ID: <dcd7cb36-11db-487a-9f3a-e652a9458efd@rfcpedant.example.org>\r\n",
+ "Subject: SMTP SSL 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",
+ "It could be a lot of lines, could be MIME encoded, whatever.\r\n",
+ "Check RFC5322.\r\n",
+ NULL
+};
+
+struct upload_status {
+ int lines_read;
+};
+
+static size_t payload_source(void *ptr, size_t size, size_t nmemb, void *userp)
+{
+ struct upload_status *upload_ctx = (struct upload_status *)userp;
+ const char *data;
+
+ if((size == 0) || (nmemb == 0) || ((size*nmemb) < 1)) {
+ return 0;
+ }
+
+ data = payload_text[upload_ctx->lines_read];
+
+ if(data) {
+ size_t len = strlen(data);
+ memcpy(ptr, data, len);
+ upload_ctx->lines_read++;
+
+ return len;
+ }
+
+ return 0;
+}
+
+int main(void)
+{
+ CURL *curl;
+ CURLcode res = CURLE_OK;
+ struct curl_slist *recipients = NULL;
+ struct upload_status upload_ctx;
+
+ upload_ctx.lines_read = 0;
+
+ 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 smtps:// rather
+ * than smtp:// to request a SSL based connection. */
+ curl_easy_setopt(curl, CURLOPT_URL, "smtps://mainserver.example.net");
+
+ /* If you want to connect to a site who isn't using a certificate that is
+ * signed by one of the certs in the CA bundle you have, you can skip the
+ * verification of the server's certificate. This makes the connection
+ * A LOT LESS SECURE.
+ *
+ * If you have a CA cert for the server stored someplace else than in the
+ * default bundle, then the CURLOPT_CAPATH option might come handy for
+ * you. */
+#ifdef SKIP_PEER_VERIFICATION
+ curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
+#endif
+
+ /* If the site you're connecting to uses a different host name that what
+ * they have mentioned in their server certificate's commonName (or
+ * subjectAltName) fields, libcurl will refuse to connect. You can skip
+ * this check, but this will make the connection less secure. */
+#ifdef SKIP_HOSTNAME_VERFICATION
+ curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
+#endif
+
+ /* Note that this option isn't strictly required, omitting it will result in
+ * libcurl sending the MAIL FROM command with empty sender data. All
+ * autoresponses should have an empty reverse-path, and should be directed
+ * to the address in the reverse-path which triggered them. Otherwise, they
+ * could cause an endless loop. See RFC 5321 Section 4.5.5 for more details.
+ */
+ 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. */
+ recipients = curl_slist_append(recipients, TO);
+ recipients = curl_slist_append(recipients, CC);
+ curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients);
+
+ /* We're using a callback function to specify the payload (the headers and
+ * body of the message). You could just use the CURLOPT_READDATA option to
+ * specify a FILE pointer to read from. */
+ 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 */
+ curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
+
+ /* Send the message */
+ res = curl_easy_perform(curl);
+
+ /* Check for errors */
+ if(res != CURLE_OK)
+ fprintf(stderr, "curl_easy_perform() failed: %s\n",
+ curl_easy_strerror(res));
+
+ /* Free the list of recipients */
+ curl_slist_free_all(recipients);
+
+ /* Always cleanup */
+ curl_easy_cleanup(curl);
+ }
+
+ return (int)res;
+}
diff --git a/docs/examples/smtp-tls.c b/docs/examples/smtp-tls.c
index 3635c103..4872dbdf 100644
--- a/docs/examples/smtp-tls.c
+++ b/docs/examples/smtp-tls.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -24,26 +24,29 @@
#include <curl/curl.h>
/* This is a simple example showing how to send mail using libcurl's SMTP
- * capabilities. It builds on the simplesmtp.c example, adding some
- * authentication and transport security.
+ * capabilities. It builds on the smtp-mail.c example to add authentication
+ * and, more importantly, transport security to protect the authentication
+ * details from being snooped.
+ *
+ * Note that this example requires libcurl 7.20.0 or above.
*/
#define FROM "<sender@example.org>"
#define TO "<addressee@example.net>"
#define CC "<info@example.org>"
-static const char *payload_text[]={
- "Date: Mon, 29 Nov 2010 21:54:29 +1100\n",
- "To: " TO "\n",
- "From: " FROM "(Example User)\n",
- "Cc: " CC "(Another example User)\n",
- "Message-ID: <dcd7cb36-11db-487a-9f3a-e652a9458efd@rfcpedant.example.org>\n",
- "Subject: SMTP TLS example message\n",
- "\n", /* empty line to divide headers from body, see RFC5322 */
- "The body of the message starts here.\n",
- "\n",
- "It could be a lot of lines, could be MIME encoded, whatever.\n",
- "Check RFC5322.\n",
+static const char *payload_text[] = {
+ "Date: Mon, 29 Nov 2010 21:54:29 +1100\r\n",
+ "To: " TO "\r\n",
+ "From: " FROM "(Example User)\r\n",
+ "Cc: " CC "(Another example User)\r\n",
+ "Message-ID: <dcd7cb36-11db-487a-9f3a-e652a9458efd@rfcpedant.example.org>\r\n",
+ "Subject: SMTP TLS 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",
+ "It could be a lot of lines, could be MIME encoded, whatever.\r\n",
+ "Check RFC5322.\r\n",
NULL
};
@@ -56,33 +59,38 @@ static size_t payload_source(void *ptr, size_t size, size_t nmemb, void *userp)
struct upload_status *upload_ctx = (struct upload_status *)userp;
const char *data;
- if ((size == 0) || (nmemb == 0) || ((size*nmemb) < 1)) {
+ if((size == 0) || (nmemb == 0) || ((size*nmemb) < 1)) {
return 0;
}
data = payload_text[upload_ctx->lines_read];
- if (data) {
+ if(data) {
size_t len = strlen(data);
memcpy(ptr, data, len);
- upload_ctx->lines_read ++;
+ upload_ctx->lines_read++;
+
return len;
}
+
return 0;
}
-
int main(void)
{
CURL *curl;
- CURLcode res;
+ CURLcode res = CURLE_OK;
struct curl_slist *recipients = NULL;
struct upload_status upload_ctx;
upload_ctx.lines_read = 0;
curl = curl_easy_init();
- if (curl) {
+ 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
@@ -106,18 +114,17 @@ int main(void)
* Instead, you should get the issuer certificate (or the host certificate
* if the certificate is self-signed) and add it to the set of certificates
* that are known to libcurl using CURLOPT_CAINFO and/or CURLOPT_CAPATH. See
- * docs/SSLCERTS for more information.
- */
+ * 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 */
+ /* Note that this option isn't strictly required, omitting it will result in
+ * libcurl sending the MAIL FROM command with empty sender data. All
+ * autoresponses should have an empty reverse-path, and should be directed
+ * to the address in the reverse-path which triggered them. Otherwise, they
+ * could cause an endless loop. See RFC 5321 Section 4.5.5 for more details.
+ */
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. */
@@ -125,28 +132,32 @@ int main(void)
recipients = curl_slist_append(recipients, CC);
curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients);
- /* In this case, we're using a callback function to specify the data. You
- * could just use the CURLOPT_READDATA option to specify a FILE pointer to
- * read from.
- */
+ /* We're using a callback function to specify the payload (the headers and
+ * body of the message). You could just use the CURLOPT_READDATA option to
+ * specify a FILE pointer to read from. */
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.
*/
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
- /* send the message (including headers) */
+ /* Send the message */
res = curl_easy_perform(curl);
+
/* Check for errors */
if(res != CURLE_OK)
fprintf(stderr, "curl_easy_perform() failed: %s\n",
curl_easy_strerror(res));
- /* free the list of recipients and clean up */
+ /* Free the list of recipients */
curl_slist_free_all(recipients);
+
+ /* Always cleanup */
curl_easy_cleanup(curl);
}
- return 0;
+
+ return (int)res;
}
diff --git a/docs/examples/smtp-vrfy.c b/docs/examples/smtp-vrfy.c
new file mode 100644
index 00000000..4e44cea9
--- /dev/null
+++ b/docs/examples/smtp-vrfy.c
@@ -0,0 +1,73 @@
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+#include <stdio.h>
+#include <string.h>
+#include <curl/curl.h>
+
+/* This is a simple example showing how to verify an email address from an
+ * SMTP server.
+ *
+ * Notes:
+ *
+ * 1) This example requires libcurl 7.34.0 or above.
+ * 2) Not all email servers support this command and even if your email server
+ * does support it, it may respond with a 252 response code even though the
+ * address doesn't exist.
+ */
+
+int main(void)
+{
+ CURL *curl;
+ CURLcode res;
+ struct curl_slist *recipients = NULL;
+
+ curl = curl_easy_init();
+ if(curl) {
+ /* This is the URL for your mailserver */
+ curl_easy_setopt(curl, CURLOPT_URL, "smtp://mail.example.com");
+
+ /* Note that the CURLOPT_MAIL_RCPT takes a list, not a char array */
+ recipients = curl_slist_append(recipients, "<recipient@example.com>");
+ curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients);
+
+ /* Perform the VRFY */
+ res = curl_easy_perform(curl);
+
+ /* Check for errors */
+ if(res != CURLE_OK)
+ fprintf(stderr, "curl_easy_perform() failed: %s\n",
+ curl_easy_strerror(res));
+
+ /* Free the list of recipients */
+ curl_slist_free_all(recipients);
+
+ /* Curl won't send the QUIT command until you call cleanup, so you should
+ * be able to re-use this connection for additional requests. It may not be
+ * a good idea to keep the connection open for a very long time though
+ * (more than a few minutes may result in the server timing out the
+ * connection) and you do want to clean up in the end.
+ */
+ curl_easy_cleanup(curl);
+ }
+
+ return 0;
+}