#!/bin/sh # # this script will out a exim .forward file in to a users # home dir to filter junk. # # this will hold which dir is used for mail JUNKLOCATION=noloc cd $home if [ -f Mail/junk ] then JUNKLOCATION="Mail" elif [ -f mail/junk ] then JUNKLOCATION="mail" else echo "junk email folder not found" echo "please create a folder called junk (with a small j)" exit fi # # now we install the filter # cd $home # check to see if they already have a .forward file if [ -f .forward ] then echo "you already have a filter file in place" echo "please contact library systems for help" echo " " exit fi # # echo "# Exim filter" > .forward echo "if error_message then finish endif" >> .forward echo "if \$header_X-UKCLib-Spam-Flag: contains \"YES\"" >> .forward echo "then" >> .forward echo "save \$home/$JUNKLOCATION/junk" >> .forward echo "seen finish" >> .forward echo "endif" >> .forward # now let them know echo "emails that look like they are spam will now be moved in to your" echo "junk email folder. NOTE you must check this folder to make sure" echo "no genuine have been put there in error" echo " " echo "$USER is now using junk filters" | mailx -s "Junk filtering" foobar@ukc.ac.uk echo "You are now using junk filters" | mailx -s "$USER junk filtering" $USER