#!/bin/bash
#
# Modify these three lines for your specific list:
MMURL="http://www.nleaudio.com/mailman"
MMLIST="testlist"
MMHOST="nleaudio.com"
#
#
_TEST=`dd count=$CONTENT_LENGTH bs=1 2> /dev/null`
eval `echo 'REQUEST_METHOD="GET"'`
eval `echo 'QUERY_STRING="$_TEST"'`
eval `/usr/bin/proccgi $*`
echo Content-type: text/html
echo
echo ""
# Is this a new subscription?
if [ $FORM_email_button = "Subscribe" ]; then
# Yes, Create Email
echo "From: $MMLIST-admin@$MMHOST" > /tmp/$_TEST
echo "To: $MMLIST-admin@$MMHOST" >> /tmp/$_TEST
echo "Subject: *NEW $MMLIST* $FORM_uname $FORM_email" >> /tmp/$_TEST
echo "" >> /tmp/$_TEST
echo "Hello Brenda," >> /tmp/$_TEST
echo "This is your friendly Mailman robot at $MMHOST." >> /tmp/$_TEST
echo "You've got a new subscription request for the $MMLIST list:" >> /tmp/$_TEST
echo "" >> /tmp/$_TEST
echo " Name: $FORM_uname" >> /tmp/$_TEST
echo " Email: $FORM_email" >> /tmp/$_TEST
echo "Reason: $FORM_reason" >> /tmp/$_TEST
echo "" >> /tmp/$_TEST
echo "Click on this link to handle the request:" >> /tmp/$_TEST
echo "$MMURL/admindb/$MMLIST" >> /tmp/$_TEST
echo "" >> /tmp/$_TEST
echo "Have a nice day!" >> /tmp/$_TEST
echo "" >> /tmp/$_TEST
/usr/lib/sendmail -f $MMLIST-admin@$MMHOST $MMLIST-admin@$MMHOST < /tmp/$_TEST
rm /tmp/$_TEST
fi
# Create Refresh to Post form
echo ""
# If you want to display any of this for debugging, here it is!
#echo "Password=$FORM_pw Pw-conf=$FORM_pw-conf
"
#echo "digest=$FORM_digest Email=$FORM_email
"
#echo "Name=$FORM_uname Reason=$FORM_reason
"
#echo "Query String is $QUERY_STRING Method=$REQUEST_METHOD"
#echo "
Query is: $_TEST
"
#echo "email_button = $FORM_email_button
"
echo ""
exit 0