[Mailman-Users] Subscribe/Unsubscribe remotely by admin

Michael Best mbest at pendragon.org
Wed May 10 00:10:55 CEST 2006


Thanks for your procmail recipe Dennis.

I went for a slightly different tact.  I'm using Exim and procmail ends 
up getting run by a user/group combination.  So I changed mailman's 
shell to /bin/bash (required for procmail to work as a user), and just 
have mailman run the add remove scripts right at the time of the email 
receipt.

Also, setting MAILDIR=/dev/null caused an error for me, so I left it out.

For the truly paranoid I would insert a step between writing the email 
address to disk and feeding it to mailman.  So far mailman has refused 
to subscribe any bad addresses for me, but it could use some 
sanitization (or this could be done on the form submission side as well).

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


TMPDIR=/tmp
#MAILDIR=/dev/null
DEFAULT=/dev/null
LOGFILE=/dev/null

# Remote script writes a From of someone at example.com
:0HB
* ^From: .*someone at example.com
* ^.*approve PassWord
{
:0Bfbwc:/tmp/listsubs.lock.$$
* ^approve PassWord subscribe
|/bin/grep ' subscribe' |/bin/sed -e 's/.*subscribe //g' >> 
/tmp/list-subs.$$; /
usr/lib/mailman/bin/add_members -w n -a n -r /tmp/list-subs.$$ listname; 
rm /tmp/list-subs.$$

:0Bfbwc:/tmp/listunsubs.lock.$$
* ^approve PassWord unsubscribe
|/bin/grep ' unsubscribe' |/bin/sed -e 's/.*unsubscribe //g' >> 
/tmp/list-unsubs
.$$; /usr/lib/mailman/bin/remove_members -n -N -f /tmp/list-unsubs.$$ 
listname; rm /tmp/list-unsubs.$$
}

# execute only if previous didn't match
# mail leftovers to owner
:0E
|/usr/lib/mailman/mail/mailman owner listname


Also a thing you left out was the format of the email to send the recipe.

My recipe above requires:

From: someone at example.com
Subject: anything you like

approve PassWord subscribe emailaddress at example.org


or

From: someone at example.com
Subject: anything you like

approve PassWord unsubscribe emailaddress at example.org



-Mike



More information about the Mailman-Users mailing list