msgbartop
MAC OS X, Linux, Windows and other IT Tips and Tricks
msgbarbottom

05 May 18 Minimize the Digests shown Headers in Mailman 2.1.xx

Problem:
Digests in Mailman are composed of a lots of unneeded headers which clutter the messages.

Solution:
Edit the Mailman configuration file manually as follows:
WARNING !!!: These headers are part of a the ‘RFC 1153’ which if changed can have unpredictable or unwanted effects.
So here I kept the headers: Date:, From:, Subject:, Keywords(if any), and Content-Type(quite important to keep)

Steps:
Rename the automatically compiled Python config file:
mv /usr/lib/mailman/Mailman/Defaults.pyc /usr/lib/mailman/Mailman/Defaults.pyc.orig

Edit the config file:
mcedit /usr/lib/mailman/Mailman/Defaults.py

and make the following changes from:

# Headers which should be kept in both RFC 1153 (plain) and MIME digests. RFC
# 1153 also specifies these headers in this exact order, so order matters.
MIME_DIGEST_KEEP_HEADERS = [
'Date', 'From', 'To', 'Cc', 'Subject', 'Message-ID', 'Keywords',
# I believe we should also keep these headers though.
'In-Reply-To', 'References', 'Content-Type', 'MIME-Version',
'Content-Transfer-Encoding', 'Precedence', 'Reply-To', 'List-Post',
# Mailman 2.0 adds these headers
'Message',
]
#
# The order in this list controls the order of the RFC 1153 digest headers.
# Also, any headers in this list will be kept in the MIME digest even if they
# don't appear in the MIME list above. Finally, headers appearing in both
# lists must be casewise the same or duplication can result in the digest.
PLAIN_DIGEST_KEEP_HEADERS = [
'Message',
# RFC 1153 headers in order
'Date', 'From', 'To', 'Cc', 'Subject', 'Message-ID', 'Keywords',
'Content-Type',
]

TO:

# Headers which should be kept in both RFC 1153 (plain) and MIME digests. RFC
# 1153 also specifies these headers in this exact order, so order matters.
#MIME_DIGEST_KEEP_HEADERS = [
# 'Date', 'From', 'To', 'Cc', 'Subject', 'Message-ID', 'Keywords',
# # I believe we should also keep these headers though.
# 'In-Reply-To', 'References', 'Content-Type', 'MIME-Version',
# 'Content-Transfer-Encoding', 'Precedence', 'Reply-To', 'List-Post',
# # Mailman 2.0 adds these headers
# 'Message',
# ]
#
MIME_DIGEST_KEEP_HEADERS = [
'Date', 'From', 'Subject', 'Keywords',
# I believe we should also keep these headers though.
'In-Reply-To', 'References', 'Content-Type', 'MIME-Version',
'Content-Transfer-Encoding', 'Precedence', 'Reply-To', 'List-Post',
]
#
# The order in this list controls the order of the RFC 1153 digest headers.
# Also, any headers in this list will be kept in the MIME digest even if they
# don't appear in the MIME list above. Finally, headers appearing in both
# lists must be casewise the same or duplication can result in the digest.
#PLAIN_DIGEST_KEEP_HEADERS = [
# 'Message',
# # RFC 1153 headers in order
# 'Date', 'From', 'To', 'Cc', 'Subject', 'Message-ID', 'Keywords',
# 'Content-Type',
# ]
#
PLAIN_DIGEST_KEEP_HEADERS = [
# RFC 1153 headers in order
'Date', 'From', 'Subject', 'Keywords',
'Content-Type',
]

Note: This might look confusing but just take a good look at the changes I made and you can see that I simply eliminated some headers from the 2 lists.
I simply kept the original version but commented it out as a reference in case things go wrong and I need to re-introduce some of them.

23 Mar 18 Changing the mailman subscribers ‘moderation’ bit on the command line

Intro:
In my mailman installation with over 3K subscribers I could not find why the web interface didn’t allow me to change the ‘moderation’ bit of subscribers, or any other property. So I found this tool which allows me to the ‘moderation’ bit for any subscriber using the command line. Sinc ethe Python module for doing this is not provided with mailman you need to add it and run the command as follows:

Add the following content to the new file called: /usr/lib/mailman/bin/mod.py
#! /usr/bin/python
# mod.py
#
from Mailman import mm_cfg
import sys
#
def mod(list):
for member in list.getMembers():
if list.getMemberOption(member, mm_cfg.Moderate):
print member, "is moderated"
#
def set(list, member, value):
value = not not (int(value))
if list.isMember(member):
list.Lock()
list.setMemberOption(member, mm_cfg.Moderate, value)
print "%s's moderated flag set to %d" % (member, value)
list.Save()
list.Unlock()
else:
print member, "not a member"

Command for changing the moderation’ bit:
eg. for myname@mydomain.com in ‘people’ mailing list
Turning ON the ‘moderation’ bit:
/usr/lib/mailman/bin/withlist -r mod.set people myname@mydomain.com 1
Turning OFF the ‘moderation’ bit:
/usr/lib/mailman/bin/withlist -r mod.set people myname@mydomain.com 0
Turning ON the ‘moderation’ bit for ALL subscribers in the mailing list:
for member in $(/usr/lib/mailman/bin/list_members people) ; do
/usr/lib/mailman/bin/withlist -r mod.set people $member 1
done