[Mailman-Users] Unsubscription Script, Try #3

Bob Puff@NLE bob at nleaudio.com
Tue Jan 16 03:09:04 CET 2001


Ok, think I figured out a safe way.  I used the <listname>-admin as the From: address in the mail to Mailman.  Also added a return message to the originating person confirming their unsubscription.  So far, this looks to be good!

Call it with a couple parameters in your aliases file.

Here is the script.  Put this in /home/mailman, or wherever else you would like it:

#!/bin/bash
#
# Mailman auto unsubscription  by Bob Puff 01/15/01
#
# Pass two parameters to this script:
# /home/mailman/unsub <list name> <domain name>

# Call from your aliases file like:
# test-unsub:   /home/mailman/unsub test yourdomain.com
#
sp="xxxxx"  # *** Put your site password here ***
#
#
read fl ;
addr="`echo $fl | awk '{print $2}'`" ;
# Yeah, it's crude, but it gets the user's address most of the time

echo "From: $1-admin@$2" > /tmp/$addr
echo "To: $1-request@$2" >> /tmp/$addr
echo "Subject: unsubscribe $sp $addr" >> /tmp/$addr
echo "" >> /tmp/$addr
echo "unsubscribe $sp $addr" >> /tmp/$addr     
echo "" >> /tmp/$addr

/usr/lib/sendmail -f $1-admin@$2 $1-request@$2 < /tmp/$addr
rm /tmp/$addr  # send the unsub to mailman, and clean up

echo "From: $1-admin@$2" > /tmp/$addr
echo "To: $addr" >> /tmp/$addr
echo "Subject: Unsubscription Confirmation" >> /tmp/$addr
echo "" >> /tmp/$addr
echo "This message is to confirm your unsubscription request to" >> /tmp/$addr
echo "the $1 list.  You will receive no more messages from" >> /tmp/$addr
echo "this list.  Thank you." >> /tmp/$addr
echo "" >> /tmp/$addr

/usr/lib/sendmail -f $1-admin@$2 $addr < /tmp/$addr
rm /tmp/$addr  # send msg to the person, and clean up




More information about the Mailman-Users mailing list