Also useful is the official Apache documentation on Server Side Includes: Apache Module mod_include
As mentioned in the tutorial, Net::SMTP is part of the libnet package. You can download a version of it that's already designed to run with the ActiveState version of Perl by using the Perl Package Manager.
Here's a sample script that uses the Net::SMTP module:
#!perl
use Net::SMTP;
$smtp = Net::SMTP->new('smtp.best.com', debug => 1);
$smtp->mail('toppa@ask.com'); # the sender's address
$smtp->to('mike@toppa.com'); # the recipient's address
$smtp->data();
# The next three lines are the email headers,
# which are analagous to the HTTP headers for web pages
$smtp->datasend("To: mike\@toppa.com\n");
$smtp->datasend("From: toppa\@ask.com\n");
# if you're using CGI, the reply address won't be the
# same as the "from" address - you need to set it as well.
$smtp->datasend("Reply-to: toppa\@ask.com\n");
# as in HTTP, two linefeeds separate the headers from the body
$smtp->datasend("\n");
# we'll use just a single-line message for the body
$smtp->datasend("A simple test message\n");
$smtp->dataend();
$smtp->quit;
Unix systems have a built-in application that you can use to send message via SMTP - it's called sendmail. Here's a sample script:
#!/usr/bin/perl
unless (open (MAIL,"|/usr/sbin/sendmail -t")) {
print "unable to open sendmail";
exit;
}
print MAIL "To: mike\@toppa.com\n";
print MAIL "From: toppa\@best.com\n";
print MAIL "Reply-To: toppa\@best.com\n";
print MAIL "Subject: test message\n\n";
print MAIL "This is a test email message\n";
close (MAIL);