Yeah, that would work, unless you want to notify more than one person. Then
it gets a little more complicated. Using the example you gave, it would be
fairly easy to create a script that notified your contact. Something like
this:
###############################
use Net::SMTP;
use strict;
my %contact_info{
name => 'John Smith',
title => 'Hard Worker',
email => '[EMAIL PROTECTED]',
pager => '1234567'
}
my $data = '';
$data .= "To: Primary Contact";
$data .= "Subject Automated Alert\n";
$data .= "\n";
$data .= "Hello, $contact_info{name},\n"; #using the hash
$data .= "This message is an automated alert to let you know that\n";
$data .= "one or more parameters are outside the acceptable range.\n";
$data .= "Please address this issue immediately.\n";
my $smtp = Net::SMTP->new('mailserver');
$smtp->mail('[EMAIL PROTECTED]');
$smtp->to($contanct_info{email}); #using the hash again
$smtp->data([$data]);
$smtp->quit();
################################
Disclaimer: This may need some tweaking since I haven't actually tested it
yet.
-----Original Message-----
From: William Black [mailto:[EMAIL PROTECTED]]
Sent: Friday, July 05, 2002 5:38 PM
To: [EMAIL PROTECTED]
Subject: RE: Quick question.
Thanks Timothy,
Other than the module, Do I have the right idea with the hash?
William
>From: Timothy Johnson <[EMAIL PROTECTED]>
>To: "'William Black'" <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
>Subject: RE: Quick question.
>Date: Fri, 5 Jul 2002 17:36:07 -0700
>
>
>You'll need access to an SMTP server. The first module I would recommend
>is
>Net::SMTP, but if you're not all that familiar with Net::SMTP, then I would
>recommend going to http://search.cpan.org and doing a search on mail, smtp,
>etc.
>
>-----Original Message-----
>From: William Black [mailto:[EMAIL PROTECTED]]
>Sent: Friday, July 05, 2002 5:28 PM
>To: [EMAIL PROTECTED]
>Subject: Quick question.
>
>
>Hi All,
>
>I'm new to Perl and I just have a quick question.
>
>Within my perl pgm I'm trying to set it up so that if an error occurs an
>email is sent to a certain person, page etc.
>
>So far All I've done is set up a hash as shown below: How can I use this
>hash and any built modules to accomplish my task. In addition, if there
>areany modules please include them.
>
>
>%contact_info{
> name => 'John Smith',
> title => 'Hard Worker',
> email => '[EMAIL PROTECTED]',
> pager => '1234567'
>};
>
>
>Thanks,
>
>William Black
>
>
>_________________________________________________________________
>MSN Photos is the easiest way to share and print your photos:
>http://photos.msn.com/support/worldwide.aspx
>
>
>--
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
William Black
_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]