diff options
author | Justin Luth <justin_luth@sil.org> | 2018-01-18 12:30:58 +0300 |
---|---|---|
committer | Justin Luth <justin_luth@sil.org> | 2018-01-30 05:23:03 +0100 |
commit | 036b51dbc49b533d1db773d8627d56ab86bca487 (patch) | |
tree | cbe3abfb2b9af47e75ebce8ad6a1cdf5411d3660 /scripting | |
parent | 3deac9691011711a3b9e50d19499c588af074d7f (diff) |
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@libreoffice.org>
Reviewed-by: Justin Luth <justin_luth@sil.org>
Diffstat (limited to 'scripting')
-rw-r--r-- | scripting/source/pyprov/mailmerge.py | 7 |
1 files changed, 5 insertions, 2 deletions
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() |