in reply to seeking sendmail enlightenment

Lots of good suggestions above. One other thing that's useful to know for debugging sendmail is the "-v" flag, which turns on "verbose" output. Try changing this line in your code:
if (open (SENDMAIL, "| $sendmailpath -t"))
to this:
if (open (SENDMAIL, "| $sendmailpath -t -v > /tmp/maildebug.txt"))
Then look at the /tmp/maildebug.txt after you run your script and you'll see the output of running the command.

Or you could just use something like the following, if you want to just see the output as part of the page (but make sure you print the Content-type header first):

if (open (SENDMAIL, "| $sendmailpath -t -v"))