One thing, I'm using postfix, not sendmail, but i've seen you are using the sendmail binary in the script, is this OK?
Thats ok,postfix has a sendmail binary as well.
Most likely the script can not log to the /var/log directory. Try to change the log file path in the script to e.g. /tmp/mailform.log