my $sendmail = '[path_to_sendmail]/sendmail.exe'; open my $sendmailFH, "|$sendmail" or die "Cannot open $sendmail: $!"; print $sendmailFH "Subject: $subject\n"; print $sendmailFH "From: $from\n"; print $sendmailFH "To: $to\n"; print $sendmailFH "Content-type: text/plain\n\n"; print $sendmailFH $body; print $sendmailFH "\n.\n"; close($sendmailFH);