[Libreoffice-commits] core.git: scripting/source
Justin Luth
justin_luth at sil.org
Tue Jan 30 04:23:25 UTC 2018
scripting/source/pyprov/mailmerge.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
New commits:
commit 036b51dbc49b533d1db773d8627d56ab86bca487
Author: Justin Luth <justin_luth at sil.org>
Date: Thu Jan 18 12:30:58 2018 +0300
tdf#63388: use SMTP_SSL for port 465
Thanks to Jurassic Pork and prrychr (tdf#99363) for the 2016 patch.
I used smtp.gmail.com as my testing server.
Port 587 is the "official" port to use for encrypted email.
I confirmed that 587 CANNOT use SMTP_SSL [SSL: UNKNOWN_PROTOCOL],
so I limited SMTP_SSL use to common TLS port 465 only.
Port 465 was temporarily recommended, but OFFICIALLY has long
since been abandoned. However, LOTS of documentation and ISPs still
recommend it as the port to use. I confirmed that 465 DOES NOT
support STARTTLS, so it is specifically excluded.
So, technically the button should say use STARTTLS instead of SSL,
but only for SMTP. IMAP/POP do use SSL, so terminology gets
rather confusing. This patch forces SSL without STARTTLS for port 465
regardless of the "use SSL" setting due to all the confusion.
Currently we don't support ANY SSL/TLS connections. With this patch
we now at least support the extremely common use case of port 465.
Change-Id: I210cc307491157c1121cfffd70cbb94347ee2856
Reviewed-on: https://gerrit.libreoffice.org/48210
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Justin Luth <justin_luth at sil.org>
diff --git a/scripting/source/pyprov/mailmerge.py b/scripting/source/pyprov/mailmerge.py
index ca18c7b17227..079744007816 100644
--- a/scripting/source/pyprov/mailmerge.py
+++ b/scripting/source/pyprov/mailmerge.py
@@ -104,7 +104,10 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
tout = _GLOBAL_DEFAULT_TIMEOUT
if dbg:
print("Timeout: " + str(tout), file=dbgout)
- self.server = smtplib.SMTP(server, port,timeout=tout)
+ if port == 465:
+ self.server = smtplib.SMTP_SSL(server, port,timeout=tout)
+ else:
+ self.server = smtplib.SMTP(server, port,timeout=tout)
#stderr not available for us under windows, but
#set_debuglevel outputs there, and so throw
@@ -116,7 +119,7 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
connectiontype = xConnectionContext.getValueByName("ConnectionType")
if dbg:
print("ConnectionType: " + connectiontype, file=dbgout)
- if connectiontype.upper() == 'SSL':
+ if connectiontype.upper() == 'SSL' and port != 465:
self.server.ehlo()
self.server.starttls()
self.server.ehlo()
More information about the Libreoffice-commits
mailing list