or download this
open(SENDMAIL, "|/usr/sbin/sendmail -t") || die "Cannot open sendmail
+: $!";
print SENDMAIL "From: some_email\@somewhere.com\n";
...
print SENDMAIL "\n\n";
print SENDMAIL $some_content;
close (SENDMAIL) or die "Cannot close sendmail: $!";