Here are some scripts that automate certain mailing list management tasks.
They are written in Python.
The next four scripts require that you have Python installed on
your workstation. The first three normally
require Python 2.4 or later, but they will work with some earlier versions
(2.0 +) if you have
ClientCookie installed. The fourth requires Python3.
More information can be obtained by running the script with the --help option
or just reading the beginning of the script.
- Retrieve the archives of a lists.topica.com list in Unix mailbox
format. Historical interest only as lists.topica.com is gone.
- Retrieve a list of the subscribers of a lists.topica.com list along
with real name, moderation and digest flags, etc. Historical interest
only as lists.topica.com is gone.
- Obtain a list of subscribers to a Mailman list with various additional
- A Python3 compatible version of mailman-subscribers.py.
The next script is a standalone Python script that can run anywhere that
Python 2.7 or Python 3 is available.
And these are standalone Python 3 scripts that can run anywhere that
Python 3 is available.
- Analyze a Mailman 2.1 subscribe log. Report by listname and by email
address, the most recent join and/or leave events within a given period
or the entire log.
- Read an archive mbox file to find and report any messages in the mbox
that might throw possibly uncaught exceptions in hyperkitty_import.
- A Python 3 compatible version of mailman 2.1's bin/cleanarch script for
escaping 'From ' lines in message bodies in Unix mbox files. This also includes
the Date: check enhancements like the cleanarch2 script below.
The rest of the scripts do not require Python on your workstation.
They run on the Mailman host machine. Thus, they
require command line access to the Mailman installation.
The next script runs on a Mailman 3 host.
- This script reads the two most recent generations of Mailman's
smtp.log and produces a report by day and list of the total number of
messages sent including administrivia.
The next scripts are stand alone Mailman 3 scripts. They have a shebang
line which is intended to run them with the python installed in the venv
in which Mailman is installed. This may need adjustment, or if Mailman is
installed in a different way, you may need to cd to an appropriate directory
before running the script. Also, there are some hard coded paths that may
need adjustment. Finally, if your database is not PostgreSQL, the database
access will need adjustment in some scripts.
- This script will delete Django users for which there is no corresponding
Mailman user or optionally a Mailman user with no list memberships. If can
also optionally delete Mailman users with no list memberships.
- This script reports on Django users that have multiple addresses, more
than one of which is designated as primary or a user address that isn't
primary. This can result from the UC_fix script.
- A simple script to delete messages from a HyperKitty archive which are
older than a supplied date.
- This script looks at django users' addresses and where there are two that
differ only in case one of which is all lower case, it deletes the mixed case
address and sets the lower case address primary. This is a workaround for
See the Mult_primary script for reporting issues that result from this process.
The next scripts are Mailman 3 scripts designed to be run by the mailman
shell command. See the beginning of the script for more information.
- Sometimes the same address gets subscribed to a list as both an address and
as a user. This causes various issues. This script finds those cases and
unsubscribes the address, leaving the user subscribed.
- Prior to Mailman 3.3.5, some tokens for user confirmations were pended with
too long a lifetime. This script removes those pendings based on when they
were pended and the configured pending_request_life rather than their
Also prior to Mailman 3.3.5, pended held_message tokens for email handling
of the message were not removed when the message was handled via REST. This
script removes those pendings too.
The next scripts are designed to run from Mailman 2.1's bin/ directory
in the same manner as Mailman's other command line tools.
Run the script with the --help option for more information.
- Check an archive mbox for inconsistencies. This is a compliment to
the standard bin/cleanarch. It checks and reports more anomalies than
cleanarch, but it doesn't attempt to fix anything.
- An enhanced version of the standard Mailman bin/cleanarch which will also
fix Date: headers which are unparseable or have dates more than
ARCHIVER_ALLOWABLE_SANE_DATE_SKEW different from the Unix-From date.
- Create a clone of an existing list with a new name (requires python 2.7).
- Like clone_list but works with python 2.5+. See comments in script for
Python 2.3 and 2.4.
If python 2.7 is available, clone_list is preferred as its argument
parsing and help are more robust.
- Remove an address or all addresses matching a regexp from the installation.
I.e. for every list, if the address is a member, it is removed. If there are
any held posts or (un)subscription requests from the address, they are removed
too. Optionally, any subscription requests from the address waiting user
confirmation are also removed.
- Reprint or remail the list welcome message for a user.
- Dump the contents of a Pipermail archive database for a given list and
archive volume. Possibly useful for diagnosing archive anomalies.
- A script for redacting selected message subjects and optionally author
names in a Pipermail archive database.
- Process held messages. Like bin/discard but allows accepting or rejecting
as well as discarding the message(s) and optionally forwarding and/or
preserving the processed message(s).
- If the request.pck entry corresponding to a heldmsg-LIST-nn.* held message
file has been somehow lost so the held message is not in the admindb
interface, this script can requeue the message from the heldmsg-LIST-nn.*
file to the in queue so it will be reprocessed and presumably held again.
- A script based on the standard add_members script, but sends invitations
instead of directly adding members. It also allows specifying additional
text to be included at the top of the invitation.
- List the contents of the pending requests file for a Mailman list.
- List the outstanding moderator requests for a Mailman list or lists.
Optionally accept, reject or discard each listed request or, also
optionally, all remaining requests of that type for that list.
- Add and or remove entries from one or more list's *_these_nonmembers
- List various information about lists and their held posts for all lists
that have held posts older than a specified number of days.
- Post all the messages in a *nix mbox file to a list.
- Prune older messages from the archives of one or more lists.
- Recode the strings in list attributes from one encoding to another. This
is useful if Mailman's encoding for a list's preferred_language is changed.
- Remove *.txt.gz files from the archive and update the index to link to
the *.txt files. Run after removing cron/nightly_gzip from the crontab.
- List and/or remove recipients from a Mailman 'out' or 'retry'
- Update the access and modification times of archived message files to
match the archived time in the file.
- Display the various options and settings for a member of a list.
Works as is for Python 2.5+. See comment in the script for Python 2.3
- Unlike the other scripts in this section, this is a bash script which
accepts arguments of the form "attribute = value" and invokes
Mailman's bin/config_list to update those attributes for a list.
This simplifies config_list usage for setting just one or a few things for
a single list.
The next group of scripts are 'withlist' scripts that run under control
of Mailman's bin/withlist script on the Mailman host machine.
See the first part of each script for additional information.
- Adds an address or regexp to the ban list of all lists.
- Set, add and/or remove owners and/or moderators of lists.
- Changes a member's address.
- Clears bounce info for members with recorded bounces. Does not re-enable
delivery. See reset_bounce.py for that.
- Displays the created_at date for a list.
- Discards all held posts and held subscription requests from a given
- Discards all held subscription requests older than a given number of
- Removes bounce_info for any address that is not a list member.
Normally, this situation should not occur. Also removes stale bounce info.
- Sometimes a site applies a patch to Mailman which adds and then uses new
list attributes, but because the patch might be against an older release, it
may not cause version updating to be done on existing lists. If that happens,
this script will force version updating to be done for the list(s) it is run
- Fixes the "-1 requests pending" bug in 2.1.5 if there are more lists
affected than is convenient to fix by visiting the admindb pages.
- Find all list members with upper case in their non-case preserved
member email addresses and convert to lower case or remove them if
the lower case member exists.
- Prints the bounce information for all list members that have any.
- An alternative to fix_url.py to set https scheme in web_page_url for
all lists at once.
- Displays the last post time for a list or all lists.
- List the contents of subscribe_auto_approval, ban_list and *_these_nonmembers
for a list or lists.
- Lists either moderated or unmoderated members of a list. (Beginning in
Mailman 2.1.21, bin/list_members can do this.)
- Rebuilds the archive TOC page for a list or lists if *.txt.gz files have
been removed and the TOC links are not to the *.txt files.
- Removes syntactically invalid addresses from a list.
This should normally only be required in cases where the address contains
leading or trailing whitespace as the pipe
bin/list_members -i <listname> | bin/remove_members -f - <listname>
should suffice otherwise.
- Enables delivery for all members or all those in a given domain
or those named members
whose delivery is disabled by bounce.
- Sets the Acknowledge posts option for all regular member addresses on
a list or lists that match a supplied argument.
- Raises the dmarc_moderation_action for a list or lists to the value of
DEFAULT_DMARC_MODERATION_ACTION if the list setting is lower.
- Set every list member's digest format to MIME and set the list's
mime_is_default_digest to MIME.
- Set or unset moderation for one or more members on a list.
- Set a list's digestable flag to No and set all current
digest members to regular delivery.
- Sets all list members to not receive from the list
those posts in which they are directly addressed in To: or Cc:
- Sets a list member's delivery to 'disabled by admin' or
optionally sets to 'disabled by bounce' and starts the notification
and deletion process.
- Set one or more of a list's admin, moderator or poster passwords.
- Set every list member's digest format to plain and set the list's
mime_is_default_digest to plain.
- Sets all members of a list to be 'unhidden'.
- Test the actions of a custom or standard handler against a test list
These scripts are custom handlers. See the FAQ at
for information on custom handler installation.
See the first part of each script for additional information.
- Implements holds for messages with no Subject:, messages which quote
digest boiler plate and (experimental) messages which quote excessively.
Also see rejectquote.txt for a sample
reject message template used by this script.
- Implements a per time period limit for a member's posts to a list
and/or total posts to the list.
- Implements a global maximum message size.