in reply to Sending e-mail problem

I'd also recommend using an existing module rather than rolling your own. I've used Mail::Sendmail (http://search.cpan.org/~mivkovic/Mail-Sendmail-0.79/ which doesn't really use sendmail) to send automatic notifications and such in a number of applications and never been disapointed.