This is what I have so far.Please look through for any syntax erros.I will appreciate your comments:
#!/usr/bin/perl -w
#use strict;
use Net::SMTP;
use Net::Config;
print "Content-type: text/plain", "\n\n";
system("cd /array1/var/
system("/usr/bin/webalizer");
# This debug flag will print debugging code to your browser,
# depending on its value
# Set this to 1 to send debug code to your browser.
# Set it to 0 to turn it off.
my $DEBUG = 1;
if($DEBUG)
{
$| = 1;
open(STDERR, ">&STDOUT");
}
# Set this variable to your smtp server name
my $ServerName = "mailfwd.nih.gov";
# Create a new SMTP object
$smtp = Net::SMTP->new($ServerName, Debug => 1);
# If you can't connect, don't proceed with the rest of the script
die "Couldn't connect to server" unless $smtp;
# Initiate the mail transaction
# Your "real" email address
my $MailFrom = "root\@rhlab.nih.gov";
# Recipient's "real" email address
my $MailTo = "benmartins\@blackplanet.com";
$smtp->mail( $MailFrom );
$smtp->to( $MailTo );
# Start the mail
$smtp->data();
# Send the header
# This address will appear in the message
$smtp->datasend("To: enmartins\@blackplanet.com\n");
# So will this one
$smtp->datasend("From: root\@rlab.nih.gov\n");
$smtp->datasend("Subject: Test Message\n");
$smtp->datasend("\n");
# Send the body.
$smtp->datasend("Hello World!\n\n");
# Send the termination string
$smtp->dataend();
# Close the connection
$smtp->quit();
exit;