1
# Copyright (C) 2001,2002 by the Free Software Foundation, Inc.
3
# This program is free software; you can redistribute it and/or
4
# modify it under the terms of the GNU General Public License
5
# as published by the Free Software Foundation; either version 2
6
# of the License, or (at your option) any later version.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
from Mailman import mm_cfg
18
from Mailman.i18n import _
19
from Mailman.mm_cfg import days
20
from Mailman.Gui.GUIBase import GUIBase
24
class Bounce(GUIBase):
25
def GetConfigCategory(self):
26
return 'bounce', _('Bounce processing')
28
def GetConfigInfo(self, mlist, category, subcat=None):
29
if category <> 'bounce':
32
_("""These policies control the automatic bounce processing system
33
in Mailman. Here's an overview of how it works.
35
<p>When a bounce is received, Mailman tries to extract two pieces
36
of information from the message: the address of the member the
37
message was intended for, and the severity of the problem causing
38
the bounce. The severity can be either <em>hard</em> or
39
<em>soft</em> meaning either a fatal error occurred, or a
40
transient error occurred. When in doubt, a hard severity is used.
42
<p>If no member address can be extracted from the bounce, then the
43
bounce is usually discarded. Otherwise, each member is assigned a
44
<em>bounce score</em> and every time we encounter a bounce from
45
this member we increment the score. Hard bounces increment by 1
46
while soft bounces increment by 0.5. We only increment the bounce
47
score once per day, so even if we receive ten hard bounces from a
48
member per day, their score will increase by only 1 for that day.
50
<p>When a member's bounce score is greater than the
51
<a href="?VARHELP=bounce/bounce_score_threshold">bounce score
52
threshold</a>, the subscription is disabled. Once disabled, the
53
member will not receive any postings from the list until their
54
membership is explicitly re-enabled (either by the list
55
administrator or the user). However, they will receive occasional
56
reminders that their membership has been disabled, and these
57
reminders will include information about how to re-enable their
60
<p>You can control both the
61
<a href="?VARHELP=bounce/bounce_you_are_disabled_warnings">number
62
of reminders</a> the member will receive and the
63
<a href="?VARHELP=bounce/bounce_you_are_disabled_warnings_interval"
64
>frequency</a> with which these reminders are sent.
66
<p>There is one other important configuration variable; after a
67
certain period of time -- during which no bounces from the member
68
are received -- the bounce information is
69
<a href="?VARHELP=bounce/bounce_info_stale_after">considered
70
stale</a> and discarded. Thus by adjusting this value, and the
71
score threshold, you can control how quickly bouncing members are
72
disabled. You should tune both of these to the frequency and
73
traffic volume of your list."""),
75
_('Bounce detection sensitivity'),
77
('bounce_processing', mm_cfg.Toggle, (_('No'), _('Yes')), 0,
78
_('Should Mailman perform automatic bounce processing?'),
79
_("""By setting this value to <em>No</em>, you disable all
80
automatic bounce processing for this list, however bounce
81
messages will still be discarded so that the list administrator
82
isn't inundated with them.""")),
84
('bounce_score_threshold', mm_cfg.Number, 5, 0,
85
_("""The maximum member bounce score before the member's
86
subscription is disabled. This value can be a floating point
89
('bounce_info_stale_after', mm_cfg.Number, 5, 0,
90
_("""The number of days after which a member's bounce information
91
is discarded, if no new bounces have been received in the
92
interim. This value must be an integer.""")),
94
('bounce_you_are_disabled_warnings', mm_cfg.Number, 5, 0,
95
_("""How many <em>Your Membership Is Disabled</em> warnings a
96
disabled member should get before their address is removed from
97
the mailing list. Set to 0 to immediately remove an address from
98
the list once their bounce score exceeds the threshold. This
99
value must be an integer.""")),
101
('bounce_you_are_disabled_warnings_interval', mm_cfg.Number, 5, 0,
102
_("""The number of days between sending the <em>Your Membership
103
Is Disabled</em> warnings. This value must be an integer.""")),
107
('bounce_unrecognized_goes_to_list_owner', mm_cfg.Toggle,
108
(_('No'), _('Yes')), 0,
109
_('''Should Mailman send you, the list owner, any bounce messages
110
that failed to be detected by the bounce processor? <em>Yes</em>
112
_("""While Mailman's bounce detector is fairly robust, it's
113
impossible to detect every bounce format in the world. You
114
should keep this variable set to <em>Yes</em> for two reasons: 1)
115
If this really is a permanent bounce from one of your members,
116
you should probably manually remove them from your list, and 2)
117
you might want to send the message on to the Mailman developers
118
so that this new format can be added to its known set.
120
<p>If you really can't be bothered, then set this variable to
121
<em>No</em> and all non-detected bounces will be discarded
122
without further processing.
124
<p><b>Note:</b> This setting will also affect all messages sent
125
to your list's -admin address. This address is deprecated and
126
should never be used, but some people may still send mail to this
127
address. If this happens, and this variable is set to
128
<em>No</em> those messages too will get discarded. You may want
130
<a href="?VARHELP=autoreply/autoresponse_admin_text">autoresponse
131
message</a> for email to the -owner and -admin address.""")),
133
('bounce_notify_owner_on_disable', mm_cfg.Toggle,
134
(_('No'), _('Yes')), 0,
135
_("""Should Mailman notify you, the list owner, when bounces
136
cause a member's subscription to be disabled?"""),
137
_("""By setting this value to <em>No</em>, you turn off
138
notification messages that are normally sent to the list owners
139
when a member's delivery is disabled due to excessive bounces.
140
An attempt to notify the member will always be made.""")),
142
('bounce_notify_owner_on_removal', mm_cfg.Toggle,
143
(_('No'), _('Yes')), 0,
144
_("""Should Mailman notify you, the list owner, when bounces
145
cause a member to be unsubscribed?"""),
146
_("""By setting this value to <em>No</em>, you turn off
147
notification messages that are normally sent to the list owners
148
when a member is unsubscribed due to excessive bounces. An
149
attempt to notify the member will always be made.""")),
153
def _setValue(self, mlist, property, val, doc):
154
# Do value conversion from web representation to internal
157
if property == 'bounce_processing':
159
elif property == 'bounce_score_threshold':
161
elif property == 'bounce_info_stale_after':
163
elif property == 'bounce_you_are_disabled_warnings':
165
elif property == 'bounce_you_are_disabled_warnings_interval':
167
elif property == 'bounce_notify_owner_on_disable':
169
elif property == 'bounce_notify_owner_on_removal':
173
_("""Bad value for <a href="?VARHELP=bounce/%(property)s"
174
>%(property)s</a>: %(val)s"""),
177
GUIBase._setValue(self, mlist, property, val, doc)
179
def getValue(self, mlist, kind, varname, params):
180
if varname not in ('bounce_info_stale_after',
181
'bounce_you_are_disabled_warnings_interval'):
183
return int(getattr(mlist, varname) / days(1))