summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scripting/source/pyprov/mailmerge.py7
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()