Timothy Johnson wrote at Sat, 06 Jul 2002 02:58:40 +0200:
> 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";
^^^
That won't work.
The \n is necessary.
(and of course a valid email adress :-))
> $data .= "Subject Automated Alert\n";
^
We need a : after the Subject.
> $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";
>
Why not use a HERE document ?
my $data = <<"MAIL";
To: Primary Contact
Subject: Automated Alert
Hello, $contact_info{name},
This message is an automated alert to let you know that
one or more parameters are outside the acceptable range.
Please address this issue immediately.
MAIL
> 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.
>
Greetings,
Janek
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]