On Tuesday 15 January 2002 16:29, [EMAIL PROTECTED] wrote: > I was pondering this idea. Great idea it is too. > But is there a way to get the email address from the FROM headers rather > than have them explicity put it in the subject line ? > > I see a problem in the FROM headers where they can have a bunch of stuff > in there like name and whatever else like "Foo Bar <[EMAIL PROTECTED]>" > > Any thoughts here? >
Easy, use: UNSUB=`grep -i "From: " - |head -1 |tr "<>" " " ` The command tr is translate, and we're using it here to convert any < or > into a blank. The rest of the script then handles it from there, looking for an isolated string that has a @ inside it. BTW: A friend of mine came up with a more elegant solution for doing the unsubscribes... - In the aliases file, add an entry for the unsubscribe email: volleyball-unsub: "|/home/mailman/ext/v-unsub" - Create the directory /home/mailman/ext mkdir /home/mailman/ext chown mail /home/mailman/ext chmod 0700 /home/mailman/ext - In /home/mailman/ext create the script "v-unsub": #!/home/mailman/ext/bash_mailman # This script runs as user mailman, but is only executable by user mail # script to unsubscribe user from volleyball list # Mail to [EMAIL PROTECTED] # Subject: unsubscribe [EMAIL PROTECTED] UNSUB=`grep -i "Subject: " - |head -1` for i in $UNSUB do /home/mailman/bin/remove_members volleyball $i done # End of script - Make the script executable: chmod a+x /home/mailman/ext/v-unsub - In the /etc/smrsh directory: ln -s /home/mailman/ext/v-unsub v-unsub - Copy and modify bash so that it runs as user mailman: cp /bin/bash /home/mailman/ext/bash_mailman chown mailman.mailman /home/mailman/ext/bash_mailman chmod 0555 /home/mailman/ext/bash_mailman chmod u+s,g+s /home/mailman/ext/bash_mailman === The directory /home/mailman/ext has rights such that only the mail user can access the files within. The copied version of "bash" now called "bash_mailman" has it's ownership changed to mailman and then has it's UID and GID bits set. Any script that runs using it as a shell will now run as the user mailman with group mailman. Wahoo! Jon Carnes ------------------------------------------------------ Mailman-Users maillist - [EMAIL PROTECTED] http://mail.python.org/mailman/listinfo/mailman-users