If by 'help' you mean that you will do some research, select a language for your platform and begin to attempt this task on your own, coming to us for advice and specific issues, then yes, I'll help.
# 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");
A quick look and it seems fine to me, does it work?
I also do not see your attachment going out, I recommend Mime::Lite for that. You can set it to use Net::SMTP but it will handle the connection internally rendering a lot of this code unneccesary.
It ran but did not send any webalizer output.It also gave an error that states: "my" variable $MailTo mask earlier declaration in some scope at /opt/admin/scripts/webstats.pl line 42.What am I doing.Help.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.