Sending emai in a perl script using sendmail
I needed a quick way to send an email when a script was done. Did some digging around and converted another CGI script to a plain perl script and finally got the syntax correct. #!/usr/bin/env perl my $sendmail = "/usr/sbin/sendmail -t"; my $reply_to = "Reply-to: replyto\@addresshere\n"; my $subject = "Subject: Some amazing subject\n"; my $send_to = "To: destination\@addresshere\n"; open (SENDMAIL, "|$sendmail") or die "Cannot open sendmail: $!\n"; print SENDMAIL $reply_to; print SENDMAIL $subject; print SENDMAIL $send_to; print SENDMAIL "Content-type: text/plain\n"; print SENDMAIL "Content here. You could also put the content in a variable above."; close(SENDMAIL);