[Mailman-Users] Subscribe/Unsubscribe remotely by admin

Dennis Black dennis.black at ualberta.ca
Wed Nov 30 20:01:07 CET 2005

Quoting Rae <rae at gitchee.com>:

> Okay, so the better way would be not to use the adminpasswd in the
> command but a userpasswd instead.
> I tried to run the command as designated in the link below but it
> does not work as expected.
>> It is not possible by email. There are comand line tools
>> bin/add_members and bin/remove_members that can do what you want if
>> you can run them from your automated process, or you can 'post' to the
>> admin mass (un)subscribe function as discussed in the archives of this
>> list, e.g., the thread beginning at
>> <http://mail.python.org/pipermail/mailman-users/2004-December/041209.html>.

Rae, the following works for me, and requires procmail.
A remote server sends an email message from a web form, and my Mailman
server handles the request. I have to substitute a real listname for 'list'
below because I have about 15 lists that do this.

list-special: "|/usr/local/bin/procmail -m /etc/procmail/.list.procmailrc"


# Remote script writes a From of someone at somewhere.com
* ^From: .*someone at somewhere.com
* ^.*approve PassWord
* ^approve PassWord subscribe
| grep ' subscribe' | sed -e s/.*=//g >> /tmp/list-subs; \
   chmod 666 /tmp/list-subs

* ^approve Password unsubscribe
| grep ' unsubscribe' | sed -e s/.*=//g >> /tmp/list-unsubs; \
   chmod 666 /tmp/list-unsubs

# execute only if previous didn't match
# mail leftovers to owner
|/usr/local/mailman/mail/mailman owner list

# Each hour, sub or unsub users from external web pages.
25,50 * * * * /usr/local/bin/hourly-cron 2>&1 > /dev/null

# Once an hour, check /tmp/list-subs and -unsubs and act appropo.
if [ -s /tmp/list-subs ]; then
/usr/local/mailman/bin/add_members -r /tmp/list-subs list
cat /dev/null > /tmp/list-subs
if [ -s /tmp/list-unsubs ]; then
/usr/local/mailman/bin/remove_members -f /tmp/list-unsubs list
cat /dev/null > /tmp/list-unsubs

Dennis Black     SysAdmin, Internet Applications
Academic Information and Communication Technologies (AICT, formerly CNS)
This communication is intended for the use of the recipient to which it is
addressed, and may contain confidential, personal, and/or privileged
information.  Please contact us immediately if you are not the intended
recipient of this communication.  If you are not the intended recipient of
this communication, do not copy, distribute, or take action on it. Any
communication received in error, or subsequent reply, should be deleted
or destroyed.

More information about the Mailman-Users mailing list