This is an automated email from the ASF dual-hosted git repository.

jim pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/openoffice.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 6e1ccbb0a4 Fix for Issue 114497 (#151)
6e1ccbb0a4 is described below

commit 6e1ccbb0a46802bbc00c0f3874f189d876a1790c
Author: Bidouille <[email protected]>
AuthorDate: Thu Nov 10 15:30:03 2022 +0100

    Fix for Issue 114497 (#151)
---
 main/scripting/source/pyprov/mailmerge.py | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/main/scripting/source/pyprov/mailmerge.py 
b/main/scripting/source/pyprov/mailmerge.py
index fd9dea774e..e3ddcddf96 100644
--- a/main/scripting/source/pyprov/mailmerge.py
+++ b/main/scripting/source/pyprov/mailmerge.py
@@ -111,15 +111,20 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
         if dbg:
             out.write("Timeout: %s\n" % str(tout))
 
-        self.server = smtplib.SMTP(server, port,timeout=tout)
+        connectiontype = xConnectionContext.getValueByName("ConnectionType")
+        if connectiontype.upper() == "SSL":
+            if not hasattr(smtplib, "SMTP_SSL"):
+                raise IllegalArgumentException("Connection type is not 
supported: " + connectiontype, self, 1)
+            self.server = smtplib.SMTP_SSL(server, port, timeout=tout)
+        else:
+            self.server = smtplib.SMTP(server, port,timeout=tout)
         if dbg:
             self.server.set_debuglevel(1)
-
-        connectiontype = xConnectionContext.getValueByName("ConnectionType")
+        
         if dbg:
             out.write("ConnectionType: %s\n" % str(connectiontype))
 
-        if connectiontype.upper() == 'SSL':
+        if connectiontype.upper() == 'INSECURE':
             self.server.ehlo()
             self.server.starttls()
             self.server.ehlo()

Reply via email to