I've been looking for a tool to send a email to multiple recipients, using a
file as input to the body of the message, that will working on multiple
operating systems, and is fairly simple since I'm new at this.
I've investiaged Mail::Mailer and Net::SMTP, but maybe because I'm a newbie
these seemed very complicated. Anyay, these modules aren't installed by
default on our NT boxes.
I found the Mail::Sendmail module out on CPAN, which should work both on
UNIX and Windows NT, and seems to have all the functionality I want, and
seems to be easy enough to use, but I'm hoping y'all can help with a few
questions of fine-tuning.
Here's the basic sendmail code:
open(TMPMAIL, "<$tmpmail");
use Mail::Sendmail;
%mail = ( To => "@slist",
From => '[EMAIL PROTECTED]',
Subject => "$HOSTNAME $QMGR MQARCH03I Just a short message
",
Body => <TMPMAIL>
);
sendmail(%mail) or die $MAIL::Sendmail::error;
print "OK. Log says: \n", $Mail::Sendmail::log;
close TMPMAIL;
For the multiple recipients I've put the fully qualified emails into an
array. This works okay.
For the body of the email their sample just shows text, or a variable that
contains text.
For the filehandle used as the body of the message, all the text is there,
it's just in the wrong order. It's a multi-line file that has a number of
file names, followed by the status of my operation, and it looks like
this....
$pg tmpmail.pl.txt
/export/home/earice/CHAN01D/logsave/Stest001.LOG
/export/home/earice/CHAN01D/logsave/Stest002.LOG
/export/home/earice/CHAN01D/logsave/Stest003.LOG
/export/home/earice/CHAN01D/logsave/Stest004.LOG
Archive Successful
(EOF):
But in the email it comes out as...
/export/home/earice/chan01d/logsave/stest002.log
: /export/home/earice/CHAN01D/logsave/Stest003.LOG
Date: Wed, 1 Aug 2001 11:44 -0400
/export/home/earice/chan01d/logsave/stest004.log
: Archive Successful
/export/home/earice/CHAN01D/logsave/Stest001.LOG
Obviously there must be a better way.
Thanks,
Beth Rice
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]