From 0cc409a44cac5ac29d0bd18fa13a4e9f2b2f2b96 Mon Sep 17 00:00:00 2001 From: Pawel Salek Date: Fri, 5 Mar 2010 21:22:15 +0100 Subject: Implement submission to smtps service. * examples/mail-file.c: allow testing submission to smtps service. * libesmtp-private.h: add negotiate_ssl() prototype. * libesmtp.h: add Starttls_OVER_SSL to starttls_option enum. * protocol.h: enable SSL on connection whenever selected. * smtp-tls.c: share negotiate_ssl(). --- examples/mail-file.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'examples') diff --git a/examples/mail-file.c b/examples/mail-file.c index 771ce5a..784410d 100644 --- a/examples/mail-file.c +++ b/examples/mail-file.c @@ -56,6 +56,7 @@ struct option longopts[] = { "mdn", no_argument, NULL, 'd', }, { "subject", required_argument, NULL, 's', }, { "reverse-path", required_argument, NULL, 'f', }, + { "ssl", no_argument, NULL, 'S', }, { "tls", no_argument, NULL, 't', }, { "require-tls", no_argument, NULL, 'T', }, { "noauth", no_argument, NULL, 1, }, @@ -98,7 +99,7 @@ main (int argc, char **argv) session = smtp_create_session (); message = smtp_add_message (session); - while ((c = getopt_long (argc, argv, "dmch:f:s:n:tTv", + while ((c = getopt_long (argc, argv, "dmch:f:s:n:StTv", longopts, NULL)) != EOF) switch (c) { @@ -138,6 +139,10 @@ main (int argc, char **argv) smtp_set_header (message, "Disposition-Notification-To", NULL, NULL); break; + case 'S': + smtp_starttls_enable (session, Starttls_OVER_SSL); + break; + case 't': smtp_starttls_enable (session, Starttls_ENABLED); break; @@ -543,6 +548,7 @@ usage (void) "\t-m,--monitor -- watch the protocol session with the server\n" "\t-c,--crlf -- translate line endings from \\n to CR-LF\n" "\t-t,--tls -- use STARTTLS extension if possible\n" + "\t-S,--ssl -- connect over SSL to smtps service\n" "\t-T,--require-tls -- require use of STARTTLS extension\n" "\t --noauth -- do not attempt to authenticate to the MSA\n" "\t--version -- show version info and exit\n" -- cgit