Okay, I realize I wrote something about this script once before
here.
I made the corrections and had this script ready to fly into production (so I thought). I was put on another task with higher priority and this went on the back burner. Now I am back and tried a test run of the program and recieved a load of error messages.
Before I get into the messages, let me give a little background on the program. The program accesses a text file. The file is formatted to where the first element is the email address. The next element(s) are files that need to be emailed to the address at the start of the line. The elements are in single quotes and seperated by commas. They are read into the program as arrays. (See the script and input below).
Now, I am needing to know what these messages are referring to and how to correct the situation. I have looked over the sender.pm and am at wits end trying to make sense of it. I appreciate the assistance. One of the error messages is
Argument "him@here.com','C:/test1.txt" isn't
numeric in array element at C:\SCRIPTS\hash.pl line 27.
This is listed is listed after each email is processed. With the respected email addresses and files. The next error messages are repeated numerous times.
print() on closed filehandle Symbol::GEN1 at C:/Perl/site/lib/Mail/Sen
+der.pm lin
e 1229.
print() on closed filehandle Symbol::GEN1 at C:/Perl/site/lib/Mail/Sen
+der.pm lin
e 816.
print() on closed filehandle Symbol::GEN1 at C:/Perl/site/lib/Mail/Sen
+der.pm lin
e 832.
print() on closed filehandle Symbol::GEN1 at C:/Perl/site/lib/Mail/Sen
+der.pm lin
e 921.
print() on closed filehandle Symbol::GEN1 at C:/Perl/site/lib/M
ail/Sender.pm line 1246.
print() on closed filehandle Symbol::GEN1 at C:/Perl/site/lib/Mail/Sen
+der.pm lin
e 1248.
readline() on closed filehandle Symbol::GEN1 at C:/Perl/site/lib/Mail/
+Sender.pm
line 1250.
Here is the content of the text file that the program accesses.
'him@here.com','C:/test1.txt'
'her@there.com','C:/test3.txt'
'it@where.com','C:/test2.txt','C:/test1.txt'
Here is the code.
#!c:/perl -w
use Mail::Sender;
my $time = localtime;
my $subj_line = "Price Change Worksheet for $time";
my $work = 'me@work.com';
open(LIST, "c:/email.txt") or die $!;
my @files;
while(<LIST>) {
s/^'//;
s/'\n?$//;
@files = split /','/, $_;
my $email = shift @files;
my $sender = new Mail::Sender( {smtp => 'mail.domain.com',from => $wor
+k}) || die "$Mail::Sender::Error\n";
$sender->OpenMultipart( {to => $email,
subject => $subj_line});
$sender->Body;
$sender->SendLine('Here are the price change worksheets.');
$sender->SendFile(
{description => 'Text File',
encoding => 'Base64',
file => \@files})
and print "Mail was sent OK." || die "$Mail::Sender::Error\n";
$sender->Close;
}
One last thing, the first email address is sent an email with the proper attachments. Thanks.
blacksmith.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.