Debugging Email Generated with a Script
When you suspect that email isn't received because the document being generated in the script is defective somehow, have the email printed to a file where it can be inspected.
Change something like this:
open (MAIL, "|/sbin/sendmail -t");
To something like this:
#open (MAIL, "|/sbin/sendmail -t"); open (MAIL,'>mail_' . time . '.txt'); sleep 1;
That will print the email to a file on your server (the time and sleep to ensure a new file is created every time an email would otherwise be sent).
That is one of my main methods of debugging email. The problem often becomes instantly obvious.
Will Bontrager