M
mike
I have a basic script that has been rrrunning for years. All of a
sudden my users get 2 copies of each.
Here is my code below. I am getting 2 copies when this is executed.
Mike
#!/usr/bin/perl
#
# name of this program is: hb_mail_test.cgi
#
# this script automatically sends email just to (e-mail address removed)
#
use strict;
use MIME::Lite;
# The base path to the hbdata files
my $filebase = "/blah";
#The file being checked
my $file = "file.txt";
# The file fully qualified
my $selected = "$filebase/$file";
my $mymsg = "Hi this is Me!<br><br>";
#open the file and read it
open MAILFILE, "<$selected" or die "Cant open \n"; #open the file for
reading
while ( <MAILFILE> )
{
$mymsg = $mymsg . "$_";
}
#close the open file you were reading
close MAILFILE or die "Cant close \n";
$mymsg = $mymsg . "<br><br>Sincerely, Mike";
print "Content-type:text/html\n\n";
print "<HTML>\n";
print "<HEAD>\n";
print "<TITLE>Mail Send</TITLE>\n";
print "</HEAD>\n";
print "This will show the mail message sent, and list the names of the
recipients.<br><br>\n";
print "<u>Recipients:</u><br>";
&SendMail($mymsg);
print "<br><u>This is the message that was sent:</u><br><br>";
print "$mymsg\n";
print "</BODY>\n";
print "</HTML>\n";
sub SendMail($)
{
#txtmsg
my $txtmsg = shift;
# To and From email addresses
my $To = "blah\@blah.net";
my $from = "blah\@blah.net";
my $msg = new MIME::Lite
From =>$from,
To =>$To,
Subject =>'Some Stuff,
Type =>'text/html',
Data =>"$txtmsg";
$msg->send;
print "$To\n";
}
sudden my users get 2 copies of each.
Here is my code below. I am getting 2 copies when this is executed.
Mike
#!/usr/bin/perl
#
# name of this program is: hb_mail_test.cgi
#
# this script automatically sends email just to (e-mail address removed)
#
use strict;
use MIME::Lite;
# The base path to the hbdata files
my $filebase = "/blah";
#The file being checked
my $file = "file.txt";
# The file fully qualified
my $selected = "$filebase/$file";
my $mymsg = "Hi this is Me!<br><br>";
#open the file and read it
open MAILFILE, "<$selected" or die "Cant open \n"; #open the file for
reading
while ( <MAILFILE> )
{
$mymsg = $mymsg . "$_";
}
#close the open file you were reading
close MAILFILE or die "Cant close \n";
$mymsg = $mymsg . "<br><br>Sincerely, Mike";
print "Content-type:text/html\n\n";
print "<HTML>\n";
print "<HEAD>\n";
print "<TITLE>Mail Send</TITLE>\n";
print "</HEAD>\n";
print "This will show the mail message sent, and list the names of the
recipients.<br><br>\n";
print "<u>Recipients:</u><br>";
&SendMail($mymsg);
print "<br><u>This is the message that was sent:</u><br><br>";
print "$mymsg\n";
print "</BODY>\n";
print "</HTML>\n";
sub SendMail($)
{
#txtmsg
my $txtmsg = shift;
# To and From email addresses
my $To = "blah\@blah.net";
my $from = "blah\@blah.net";
my $msg = new MIME::Lite
From =>$from,
To =>$To,
Subject =>'Some Stuff,
Type =>'text/html',
Data =>"$txtmsg";
$msg->send;
print "$To\n";
}