Premature end of script headers (bug?)

here’s a new one:

we received mail from a user with an invalid e-mail address. (mail was
submitted via a form, user is dumb.) the address was, for example,
“johndoe@.com”.

we didn’t notice this at first and replied to his ticket normally. rt
crashes out with “premature end of script headers” while trying to send the
response. took a few minutes to figure out what the problem was, then
everything made sense – sendmail got upset about the invalid e-mail
address.

what would be the ‘graceful’ fix for this? how should this be handled
properly? have rt check for invalidness before attempting to send the mail,
or just catch mailer errors a bit better?
Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com