A simple CGI sendmail script
This example program illustrates the use of sendmail
to
send an email using a Perl CGI script. Please substitute your own
email address in the program before using it - I don't want your test
mails!
#!/usr/local/bin/perl use warnings; use strict; print <<EOF; Content-type: text/plain EOF eval { open my $sendmail, "| /usr/bin/sendmail -oi -oeq -t" or die $!; print $sendmail <<EOF; to: ben.bullock\@lemoda.net Testing 1 2 3 EOF close $sendmail or die "Error closing sendmail: $!"; }; if ($@) { print "Error: $@\n"; } else { print "OK.\n"; }
Copyright © Ben Bullock 2009-2024. All
rights reserved.
For comments, questions, and corrections, please email
Ben Bullock
(benkasminbullock@gmail.com).
/
Privacy /
Disclaimer