I too would like: to see your real code, not the mistyping of it you gave; to know what changed when it stopped working; and to know what exactly "gives error message" and what the message is. You're not giving us a lot to go on, here.
You should include $? in your error message, like close MAIL || die "sendmail error $! status $?";.