From 15e0573756e18870b4f8ae7a26b272b792baf94d Mon Sep 17 00:00:00 2001 From: Mark Sapiro Date: Thu, 16 Oct 2014 22:09:49 -0700 Subject: Implemented the ability to forward bounces to the list owner. --- Mailman/Bouncer.py | 13 ++++++++++--- Mailman/Defaults.py.in | 4 ++++ Mailman/Gui/Bounce.py | 11 ++++++++++- Mailman/Version.py | 2 +- Mailman/versions.py | 3 +++ NEWS | 10 ++++++++++ 6 files changed, 38 insertions(+), 5 deletions(-) diff --git a/Mailman/Bouncer.py b/Mailman/Bouncer.py index 29fe4ea5..2a1cb539 100644 --- a/Mailman/Bouncer.py +++ b/Mailman/Bouncer.py @@ -1,4 +1,4 @@ -# Copyright (C) 1998-2012 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2014 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 @@ -89,6 +89,8 @@ class Bouncer: mm_cfg.DEFAULT_BOUNCE_YOU_ARE_DISABLED_WARNINGS_INTERVAL self.bounce_unrecognized_goes_to_list_owner = \ mm_cfg.DEFAULT_BOUNCE_UNRECOGNIZED_GOES_TO_LIST_OWNER + self.bounce_notify_owner_on_bounce_increment = \ + mm_cfg.DEFAULT_BOUNCE_NOTIFY_OWNER_ON_BOUNCE_INCREMENT self.bounce_notify_owner_on_disable = \ mm_cfg.DEFAULT_BOUNCE_NOTIFY_OWNER_ON_DISABLE self.bounce_notify_owner_on_removal = \ @@ -135,6 +137,7 @@ class Bouncer: siblist.Unlock() return info = self.getBounceInfo(member) + first_today = True if day is None: # Use today's date day = time.localtime()[:3] @@ -155,6 +158,7 @@ class Bouncer: return elif info.date == day: # We've already scored any bounces for this day, so ignore it. + first_today = False syslog('bounce', '%s: %s already scored a bounce for date %s', self.internal_name(), member, time.strftime('%d-%b-%Y', day + (0,0,0,0,1,0))) @@ -189,6 +193,9 @@ class Bouncer: info.reset(0, info.date, info.noticesleft) else: self.disableBouncingMember(member, info, msg) + elif self.bounce_notify_owner_on_bounce_increment and first_today: + self.__sendAdminBounceNotice(member, msg, + did=_('bounce score incremented')) # We've set/changed bounce info above. We now need to tell the # MemberAdaptor to set/update it. We do it here in case the # MemberAdaptor stores bounce info externally to the list object to @@ -218,7 +225,7 @@ class Bouncer: if self.bounce_notify_owner_on_disable: self.__sendAdminBounceNotice(member, msg) - def __sendAdminBounceNotice(self, member, msg): + def __sendAdminBounceNotice(self, member, msg, did=_('disabled')): # BAW: This is a bit kludgey, but we're not providing as much # information in the new admin bounce notices as we used to (some of # it was of dubious value). However, we'll provide empty, strange, or @@ -230,7 +237,7 @@ class Bouncer: {'listname' : self.real_name, 'addr' : member, 'negative' : '', - 'did' : _('disabled'), + 'did' : did, 'but' : '', 'reenable' : '', 'owneraddr': siteowner, diff --git a/Mailman/Defaults.py.in b/Mailman/Defaults.py.in index 3ecf996a..23215116 100755 --- a/Mailman/Defaults.py.in +++ b/Mailman/Defaults.py.in @@ -1344,6 +1344,10 @@ DEFAULT_BOUNCE_YOU_ARE_DISABLED_WARNINGS_INTERVAL = days(7) # failed to match by the bounce detector? DEFAULT_BOUNCE_UNRECOGNIZED_GOES_TO_LIST_OWNER = Yes +# Does the list owner get a copy of every recognized bounce that increments +# the score for a list member but doesn't result in a disable or probe? +DEFAULT_BOUNCE_NOTIFY_OWNER_ON_BOUNCE_INCREMENT = No + # Notifications on bounce actions. The first specifies whether the list owner # should get a notification when a member is disabled due to bouncing, while # the second specifies whether the owner should get one when the member is diff --git a/Mailman/Gui/Bounce.py b/Mailman/Gui/Bounce.py index 1dc837fc..e559dcc8 100644 --- a/Mailman/Gui/Bounce.py +++ b/Mailman/Gui/Bounce.py @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2004 by the Free Software Foundation, Inc. +# Copyright (C) 2001-2014 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 @@ -142,6 +142,15 @@ class Bounce(GUIBase): autoresponse message for email to the -owner and -admin address.""")), + ('bounce_notify_owner_on_bounce_increment', mm_cfg.Toggle, + (_('No'), _('Yes')), 0, + _("""Should Mailman notify you, the list owner, when bounces + cause a member's bounce score to be incremented?"""), + _("""Setting this value to Yes will cause Mailman to + send a notice including a copy of the bounce message to the list + owners whenever a bounce increments a member's bounce score but + doesn't cause a disable or a probe to be sent.""")), + ('bounce_notify_owner_on_disable', mm_cfg.Toggle, (_('No'), _('Yes')), 0, _("""Should Mailman notify you, the list owner, when bounces diff --git a/Mailman/Version.py b/Mailman/Version.py index f39931cc..66eed767 100644 --- a/Mailman/Version.py +++ b/Mailman/Version.py @@ -37,7 +37,7 @@ HEX_VERSION = ((MAJOR_REV << 24) | (MINOR_REV << 16) | (MICRO_REV << 8) | (REL_LEVEL << 4) | (REL_SERIAL << 0)) # config.pck schema version number -DATA_FILE_VERSION = 104 +DATA_FILE_VERSION = 105 # qfile/*.db schema version number QFILE_SCHEMA_VERSION = 3 diff --git a/Mailman/versions.py b/Mailman/versions.py index a6cc51cc..9006ec0c 100755 --- a/Mailman/versions.py +++ b/Mailman/versions.py @@ -370,6 +370,9 @@ def NewVars(l): add_only_if_missing( 'bounce_unrecognized_goes_to_list_owner', mm_cfg.DEFAULT_BOUNCE_UNRECOGNIZED_GOES_TO_LIST_OWNER) + add_only_if_missing( + 'bounce_notify_owner_on_bounce_increment', + mm_cfg.DEFAULT_BOUNCE_NOTIFY_OWNER_ON_BOUNCE_INCREMENT) add_only_if_missing( 'bounce_notify_owner_on_disable', mm_cfg.DEFAULT_BOUNCE_NOTIFY_OWNER_ON_DISABLE) diff --git a/NEWS b/NEWS index 37371e6a..ece6b694 100755 --- a/NEWS +++ b/NEWS @@ -7,6 +7,16 @@ Here is a history of user visible changes to Mailman. 2.1.19 (xx-xxx-xxxx) + New Features + + - There is a new list attribute in the Bounce processing section. + bounce_notify_owner_on_bounce_increment if set to Yes will cause + Mailman to notify the list owner on every bounce that increments a + list member's score but doesn't result in a probe or disable. There + is a new configuration setting setting + DEFAULT_BOUNCE_NOTIFY_OWNER_ON_BOUNCE_INCREMENT to set the default + for new lists. This in turn defaults to No. (LP: #1382150) + Changed behavior - Mailman's log files, request.pck files and heldmsg-* files are no -- cgit v1.2.3