open (MAIL,"| /usr/sbin/sendmail || die "$!";) print MAIL << "EOF"; To: joe@here.com From: smith@here.com Subject: data subject message body here EOF close MAIL || die "$!";