GNU Mailman is one of the most popular mailing list programs, particularly amongst the Linux community. Most of its features can be conveniently accessed from its web interface or by using a series of scripts that come with it for the command shell.

However, Mailman is sorely lacking a script that adds e-mail addresses to its ban list, and then unsubscribing those users requires a separate procedure. There's really no excuse, but we created a solution. Our 'block_member' script automatically removes e-mail addresses from all list subscriptions, and then it globally bans those addresses from all lists. It removes members before banning them, to prevent a situation whereby a banned user is unable to unsubscribe. This is a something that has been lacking in Mailman for a very long time.

To use the script, save it to a file on your server in a directory that is in root's path. Edit the MAILMAN_BIN parameter to point to your 'mailman/bin' directory, then make the file executable.

The 'block_member' Script

Run the script followed by the e-mail address or addresses that are to be banned. It can be used to ban multiple e-mail addresses that are separated by a space at once, as shown below:


If the script fails, make sure that the section beginning with 'def add_banned(mlist, address):' is properly indented. Remove spaces and insert tabs to make that section look the same as it does above.

Be sure to edit the 'MAILMAN_BIN' parameter to properly match the location of your 'mailman/bin' directory, if the location is different on your system.

This script was made for Linux. It will not work on a crippled operating system, such as Windoze. It requires an operating system that has both a Bash command interpreter, and the GNU utilities.

Feel free to contact us or leave a comment if you have any problems.

The Claimer: The information provided herein is intended to be a truthful and corrective alternative to the advice that is provided by physicians and other medical professionals. It is intended to diagnose, treat, cure, and prevent disease.