[Mailman-Users] Regexp for blocking addresses

Mark Sapiro mark at msapiro.net
Tue Sep 29 18:55:30 CEST 2015

On 09/29/2015 08:24 AM, Matthew Saltzman wrote:
> Got it, thanks. I will switch to that one. Now would like to figure out
> how to delete all my futile attempts from the ban list. Tried modifying
> the ban script to remove instead of append, but I'm still doing
> something wrong.

If the various list's ban_list attributes were empty to start with, use
the following withlist script based on

"""Set the ban_list for all lists to a single address or regexp.

Save as bin/set_banned.py

Run via

   bin/withlist -a -r set_banned -- <address_to_ban>

where <address_to_ban> is the actual email address or regexp
to be set as ban_list for all lists.

def set_banned(mlist, address):
    if not mlist.Locked():
    mlist.ban_list = [address]

If you want to remove individual regexps/addresses from all list's
ban_list, changing 'ban_list.append(address)' to
'ban_list.remove(address)' in whatever script you were using should
work, but the value of 'address' has to be exactly what is in ban_list
that you want to remove.

Mark Sapiro <mark at msapiro.net>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan

More information about the Mailman-Users mailing list