in reply to Unexpected 'newline' token breaks sendmail.

Also fishy is the fact that you use Mail::Mailer and then . . . erm, don't use it and reimplement your own. Presuming you've got the qmail compatibility sendmail command in place I'd think Mail::Mailer should use it just fine.