From 89d53a071fffb79054382032317110071083c51f Mon Sep 17 00:00:00 2001 From: "Adam D. Ruppe" Date: Mon, 6 Jul 2020 10:55:20 -0400 Subject: [PATCH] starttls --- email.d | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/email.d b/email.d index f72111c..039a78d 100644 --- a/email.d +++ b/email.d @@ -267,7 +267,19 @@ class EmailMessage { smtp.verifyHost = false; smtp.verifyPeer = false; - // smtp.verbose = true; + //smtp.verbose = true; + + { + // std.net.curl doesn't work well with STARTTLS if you don't + // put smtps://... and if you do, it errors if you can't start + // with a TLS connection from the beginning. + + // This change allows ssl if it can. + import std.net.curl; + import etc.c.curl; + smtp.handle.set(CurlOption.use_ssl, CurlUseSSL.tryssl); + } + if(mailServer.username.length) smtp.setAuthentication(mailServer.username, mailServer.password); const(char)[][] allRecipients = cast(const(char)[][]) (to ~ cc ~ bcc); // WTF cast