[Mailman-Users] Clearing Bounce Scores Globally

Dave (FitEyes) dave at fiteyes.com
Thu Jun 7 18:15:39 CEST 2012

How about something like this code?

Clear (erase) bounce statistics (scores) for all members (intended to be
used with the optional domain parameter only)
Modified from original reset_bounce.py by Mark Sapiro.

Save as bin/clear_bounce_info.py

Run via

   bin/withlist -r clear_bounce_info <listname> [options]
   bin/withlist -r clear_bounce_info <listname> --domain=example.com--verbose


   bin/withlist -a -r clear_bounce_info -- [options]

to do all lists.

    -d domain
        Only reset those users with addresses in domain.

        Print line for each member changed and a summary with total number
of users reset.

import sys
import getopt

from Mailman import MemberAdaptor

def usage(code, msg=''):
    if code:
        fd = sys.stderr
        fd = sys.stdout
    print >> fd, __doc__
    if msg:
        print >> fd, msg

def clear_bounce_info(mlist, *args):

        opts, args = getopt.getopt(args, 'd:v', ['domain=', 'verbose'])
    except getopt.error, msg:
        usage(1, msg)

    verbose = 0
    domain = None
    for opt, arg in opts:
        if opt in ('-d', '--domain'):
            domain = arg.lower()
        elif opt in ('-v', '--verbose'):
            verbose = 1

    if not mlist.Locked():
    count = 0
    for member in mlist.getMembers():
        if domain and not member.endswith(domain):
        del mlist.bounce_info[member]
        count += 1
        if verbose:
            print 'list: %s - bounce info deleted for %s' %
(mlist.internal_name(), member)
    if verbose:
        print 'List %s: Reset %d bouncing members.' % (mlist.real_name,

On Thu, Jun 7, 2012 at 11:49 AM, Barry S, Finkel <bsfinkel at att.net> wrote:

> On 6/7/2012 10:23 AM, Terry Earley wrote:
>> We need to clear/reset bounce stats for Yahoo members on our list. we
>> modified Mark Sapiro's script at:
>> http://www.msapiro.net/**scripts/reset_bounce.py<http://www.msapiro.net/scripts/reset_bounce.py>
>> to modify only Yahoo email addresses, but it cleared only 2 that had been
>> bouncing. That squares with the comment at top:
>>  """Enable delivery for all bouncing members.
>>>  is there a way to make it clear bounce stats for all (in this case
>> Yahoo)
>> to avoid these members from going over threshold? If not, we could run the
>> script after we get the admin notice that they are set to nomail for
>> bounces.
>>  If I understand what you want, I believe you change:
>        if mlist.getDeliveryStatus(**member) == MemberAdaptor.BYBOUNCE:
>            mlist.setDeliveryStatus(**member, MemberAdaptor.ENABLED)
>            count += 1
> by removing the "if" line and un-indenting the next two lines.  This will
> set all addresses in the domain to ENABLED.  But, I believe, this will no
> do
> exactly what you want, because you are not resetting the bounce score.
> If a yahoo.com subscriber has a bounce score of 4, then setting
>     MemberAdaptor,ENABLED
> will be resetting the value to what it already is, and the next bounce
> will (if the bounce score trigger is the default 5.0) will set BYBOUNCE.
> I have not looked at the code to see if setting ENABLED also resets
> the bounce score back to 0.
> --Barry Finkel

More information about the Mailman-Users mailing list