Front page | perl.beginners |
Postings from July 2023
configuring Net::SMTP
Thread Next
From:
Rick T
Date:
July 8, 2023 15:37
Subject:
configuring Net::SMTP
Message ID:
70D10170-E87A-4CFB-B4D2-2C089D7BB470@reason.net
I have two subroutines (below) in a program that uses Net::SMTP. I’ve recently moved my site from FutureQuest.net <http://futurequest.net/> to Hostgator.com <http://hostgator.com/>, and this part of my program has stopped working. The first routine sends an analysis of a test to me at Reason.net <http://reason.net/>, and the second send a score to several addresses associated with the student. On my new host at Hostgator both fail to do this. (One of the “technicians” at Hostgator said he found my email, so one or both likely arrived at webmaster@hostgator.com <mailto:webmaster@hostgator.com>.)
I am not trained in computer tech; I’m just a 78 year old high school teacher who bought a few books on perl, so I don’t really understand how to fill in the many variable assignments that make up most of these two routines. Instead I took guesses and tried stuff to see what would happen. If any of you have suggestions or corrections, I’d be grateful!
Rick Triplett
FIRST SUBROUTINE:
sub email_analysis { # to LibertyLearning for score posting and analysis
my $n_max = shift;
my @analysis = define_analysis($n_max);
my $subject_line
= "$pf{percent_correct_final} $pf{name_full} $course_file\n";
# Send administration an email of statistical analysis
my $to = 'socrates@reason.net';
my $from = 'webmaster@LibertyLearning.com';
my $site = 'libertylearning.com';
my $smtp_host = 'mail.libertylearning.com';
my $smtp = Net::SMTP->new( $smtp_host, Hello => $site );
$smtp->mail($from);
$smtp->to($to);
$smtp->data();
$smtp->datasend("From: webmaster\@LibertyLearning.com\n");
$smtp->datasend("To: $to\n");
$smtp->datasend("Date: $pf{ date_ended }\n");
$smtp->datasend("Subject: $subject_line\n");
$smtp->datasend("\n");
$smtp->datasend("$student_id\n");
$smtp->datasend("$pf{percent_correct_final}\n");
$smtp->datasend("squandered: $pf{percent_squandered}\%\n");
$smtp->datasend("if tried: $pf{if_tried}\%\n");
$smtp->datasend("string_of_wrongs: $pf{string_of_wrongs}\n");
foreach (@analysis) {$smtp->datasend("$_\n")};
$smtp->dataend();
$smtp->quit;
return;
}
SECOND SUBRUTINE:
sub email_mentors {
my $message = shift;
my $to = 'socrates@reason.net'; #was my $to = shift;
my $from = 'webmaster@LibertyLearning.com';
my $site = 'libertylearning.com';
my $smtp_host = 'mail.LibertyLearning.com';
my $smtp = Net::SMTP->new( $smtp_host, Hello => $site );
$smtp->mail($from);
$smtp->to($to);
$smtp->data();
$smtp->datasend("From: no_reply\@LibertyLearning.com\n");
$smtp->datasend("To: $to\n");
$smtp->datasend("Date: $pf{ date_ended }\n");
$smtp->datasend("Subject: Test Results\n");
$smtp->datasend("\n");
$smtp->datasend("$message\n");
$smtp->dataend();
$smtp->quit;
return;
}
Thread Next
-
configuring Net::SMTP
by Rick T