I think that your problem is that you are using PATH as a variable when bash uses the PATH variable to find programs to run. Your script runs OK until you get to this statement:
mail -s "Monthly spam statistic of 'hostname' " $TO < $TMPFOLDER/spamstat.$$
Then bash goes to the directory /var/log and looks for an executable program called mail.
Whatever /var/log/mail might be, it is not an executable program so you get a permissions error.
I suggest that you rename your PATH variable to something that Linux does not use.
___________________________________
Be prepared. Create a LifeBoat CD.
http://users.rcn.com/srstites/LifeBo...home.page.html
Steve Stites