From a70edc26ac027f6278a38bbe10c921b962adbf7a Mon Sep 17 00:00:00 2001 From: Mark Sapiro Date: Tue, 19 Apr 2016 15:53:54 -0700 Subject: Use nonmember_rejection_notice as the default reject reason for a held nonmember post. --- Mailman/Handlers/Hold.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'Mailman/Handlers') diff --git a/Mailman/Handlers/Hold.py b/Mailman/Handlers/Hold.py index 5452d06a..dcc7f963 100644 --- a/Mailman/Handlers/Hold.py +++ b/Mailman/Handlers/Hold.py @@ -1,4 +1,4 @@ -# Copyright (C) 1998-2011 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2016 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -28,6 +28,7 @@ Finally an exception is raised to let the pipeline machinery know that further message handling should stop. """ +import re import email from email.MIMEText import MIMEText from email.MIMEMessage import MIMEMessage @@ -220,7 +221,14 @@ def hold_for_approval(mlist, msg, msgdata, exc): # We need to send both the reason and the rejection notice through the # translator again, because of the games we play above reason = Utils.wrap(exc.reason_notice()) - msgdata['rejection_notice'] = Utils.wrap(exc.rejection_notice(mlist)) + if isinstance(exc, NonMemberPost) and mlist.nonmember_rejection_notice: + msgdata['rejection_notice'] = Utils.wrap(re.sub( + '%(listowner)s', + mlist.GetOwnerEmail(), + mlist.nonmember_rejection_notice, + )) + else: + msgdata['rejection_notice'] = Utils.wrap(exc.rejection_notice(mlist)) id = mlist.HoldMessage(msg, reason, msgdata) # Now we need to craft and send a message to the list admin so they can # deal with the held message. -- cgit v1.2.3 From 97557e37b4436ea4bf09ef618e6105951266b838 Mon Sep 17 00:00:00 2001 From: Mark Sapiro Date: Wed, 20 Apr 2016 20:14:20 -0700 Subject: Remove (incorrect) re.sub in favor of str.replace. --- Mailman/Handlers/Hold.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'Mailman/Handlers') diff --git a/Mailman/Handlers/Hold.py b/Mailman/Handlers/Hold.py index dcc7f963..2faebae1 100644 --- a/Mailman/Handlers/Hold.py +++ b/Mailman/Handlers/Hold.py @@ -28,7 +28,6 @@ Finally an exception is raised to let the pipeline machinery know that further message handling should stop. """ -import re import email from email.MIMEText import MIMEText from email.MIMEMessage import MIMEMessage @@ -222,11 +221,9 @@ def hold_for_approval(mlist, msg, msgdata, exc): # translator again, because of the games we play above reason = Utils.wrap(exc.reason_notice()) if isinstance(exc, NonMemberPost) and mlist.nonmember_rejection_notice: - msgdata['rejection_notice'] = Utils.wrap(re.sub( - '%(listowner)s', - mlist.GetOwnerEmail(), - mlist.nonmember_rejection_notice, - )) + msgdata['rejection_notice'] = Utils.wrap( + mlist.nonmember_rejection_notice.replace( + '%(listowner)s', owneraddr)) else: msgdata['rejection_notice'] = Utils.wrap(exc.rejection_notice(mlist)) id = mlist.HoldMessage(msg, reason, msgdata) -- cgit v1.2.3 From 7ed5fe5c0668f2014a7f7a08376b4e6a2e3e921c Mon Sep 17 00:00:00 2001 From: Mark Sapiro Date: Thu, 21 Apr 2016 08:01:01 -0700 Subject: Implimented mm_cfg.SMTPLIB_DEBUG_LEVEL setting. --- Mailman/Handlers/SMTPDirect.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Mailman/Handlers') diff --git a/Mailman/Handlers/SMTPDirect.py b/Mailman/Handlers/SMTPDirect.py index 1d11d19a..32b03423 100644 --- a/Mailman/Handlers/SMTPDirect.py +++ b/Mailman/Handlers/SMTPDirect.py @@ -1,4 +1,4 @@ -# Copyright (C) 1998-2011 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2016 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -61,6 +61,7 @@ class Connection: def __connect(self): self.__conn = smtplib.SMTP() + self.__conn.set_debuglevel(mm_cfg.SMTPLIB_DEBUG_LEVEL) self.__conn.connect(mm_cfg.SMTPHOST, mm_cfg.SMTPPORT) self.__numsessions = mm_cfg.SMTP_MAX_SESSIONS_PER_CONNECTION -- cgit v1.2.3 From d2145608089777cd27175763cf9f71ca2a3159f5 Mon Sep 17 00:00:00 2001 From: Mark Sapiro Date: Fri, 6 May 2016 14:44:28 -0700 Subject: Implement SASL and STARTTLS in SMTPDirect.py. --- Mailman/Handlers/SMTPDirect.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'Mailman/Handlers') diff --git a/Mailman/Handlers/SMTPDirect.py b/Mailman/Handlers/SMTPDirect.py index 32b03423..3b489c2f 100644 --- a/Mailman/Handlers/SMTPDirect.py +++ b/Mailman/Handlers/SMTPDirect.py @@ -63,6 +63,36 @@ class Connection: self.__conn = smtplib.SMTP() self.__conn.set_debuglevel(mm_cfg.SMTPLIB_DEBUG_LEVEL) self.__conn.connect(mm_cfg.SMTPHOST, mm_cfg.SMTPPORT) + if mm_cfg.SMTP_AUTH: + if mm_cfg.SMTP_USE_TLS: + try: + self.__conn.starttls() + except SMTPException, e: + syslog('smtp-failure', 'SMTP TLS error: %s', e) + self.quit() + raise + try: + self.__conn.ehlo(mm_cfg.SMTP_HELO_HOST) + except SMTPException, e: + syslog('smtp-failure', 'SMTP EHLO error: %s', e) + self.quit() + raise + try: + self.__conn.login(mm_cfg.SMTP_USER, mm_cfg.SMTP_PASSWD) + except smtplib.SMTPHeloError, e: + syslog('smtp-failure', 'SMTP HELO error: %s', e) + self.quit() + raise + except smtplib.SMTPAuthenticationError, e: + syslog('smtp-failure', 'SMTP AUTH error: %s', e) + self.quit() + raise + except smtplib.SMTPException, e: + syslog('smtp-failure', + 'SMTP - no suitable authentication method found: %s', e) + self.quit() + raise + self.__numsessions = mm_cfg.SMTP_MAX_SESSIONS_PER_CONNECTION def sendmail(self, envsender, recips, msgtext): -- cgit v1.2.3