use strict; my $sendmail = '/usr/lib/sendmail -t'; open (MAIL,"|$sendmail") || "Not working: $!"; print MAIL <<"EOF"; To: smith\@here.com From: jones\@here.com Subject: theSubject Information here etc EOF close MAIL || "Not working: $!";