subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r1777846 - in /subversion/trunk/tools/hook-scripts/mailer: mailer.conf.example mailer.py
Date Sat, 07 Jan 2017 19:35:49 GMT
Author: julianfoad
Date: Sat Jan  7 19:35:49 2017
New Revision: 1777846

URL: http://svn.apache.org/viewvc?rev=1777846&view=rev
Log:
Allow configuring mailer.py to use SMTP SSL, using a new 'smtp_ssl' option
in the [general] section of mailer.conf.

Discussed in users@ thread "post-commit hook" around 2016-12-22, archived at
e.g. https://svn.haxx.se/users/archive-2016-12/0104.shtml

* tools/hook-scripts/mailer/mailer.conf.example
  (general): Add an example of the new option.

* tools/hook-scripts/mailer/mailer.py
  (SMTPOutput): Use smtplib.SMTP_SSL instead of smtplib.SMTP if the option
    is set.

Patch by: João M. S. Silva <joao.m.santos.silva{_AT_}gmail.com>
Tweaked by me.

Modified:
    subversion/trunk/tools/hook-scripts/mailer/mailer.conf.example
    subversion/trunk/tools/hook-scripts/mailer/mailer.py

Modified: subversion/trunk/tools/hook-scripts/mailer/mailer.conf.example
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/hook-scripts/mailer/mailer.conf.example?rev=1777846&r1=1777845&r2=1777846&view=diff
==============================================================================
--- subversion/trunk/tools/hook-scripts/mailer/mailer.conf.example (original)
+++ subversion/trunk/tools/hook-scripts/mailer/mailer.conf.example Sat Jan  7 19:35:49 2017
@@ -27,6 +27,10 @@
 #smtp_username = example
 #smtp_password = example
 
+# This option specifies whether to use SSL from the beginning of the SMTP
+# connection.
+#smtp_ssl = yes
+
 # --------------------------------------------------------------------------
 
 #

Modified: subversion/trunk/tools/hook-scripts/mailer/mailer.py
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/hook-scripts/mailer/mailer.py?rev=1777846&r1=1777845&r2=1777846&view=diff
==============================================================================
--- subversion/trunk/tools/hook-scripts/mailer/mailer.py (original)
+++ subversion/trunk/tools/hook-scripts/mailer/mailer.py Sat Jan  7 19:35:49 2017
@@ -291,7 +291,10 @@ class SMTPOutput(MailedOutput):
     self.write(self.mail_headers(group, params))
 
   def finish(self):
-    server = smtplib.SMTP(self.cfg.general.smtp_hostname)
+    if self.cfg.is_set('general.smtp_ssl') and self.cfg.general.smtp_ssl == 'yes':
+      server = smtplib.SMTP_SSL(self.cfg.general.smtp_hostname)
+    else:
+      server = smtplib.SMTP(self.cfg.general.smtp_hostname)
     if self.cfg.is_set('general.smtp_username'):
       server.login(self.cfg.general.smtp_username,
                    self.cfg.general.smtp_password)



Mime
View raw message