I am very new to the Perl game and need some help
I have a Perl application which works fine and can output some plain text information that I need to send to selected users via e-mail.
The e-mail address are under the $addr and the information that I whish to put in the e-mail message are held in $msg
I have installed and have working Sendmail the script that I have come up with so far is
Expand|Select|Wrap|Line Numbers
- sub send_mail
- {
- my $addr = shift;
- my $msg = shift;'
- my %mail;
- my $body;
- # start a new mail message
- # setup the headers
- %mail = (
- To => 'fred@me.net',
- From => 'bob@me.net',
- subject =>' Warning information',
- Message =>'This mail message was generated automatically
- and has been sent to you because you have requested certain this information via email’,
- );
- # close the mail object (causes it to be sent)
- sendmail(%mail) or die $Mail::Sendmail::error;
- print "OK. Log says:\n", $Mail::Sendmail::log;
How do I get the $addr tag to automatically put the recipients email address into the to field?
Secondly how do I get the $msg tag to automatically put its information into the e-mail message.
This will I guess be either very easy or am I asking the impossible?
I have now spent severally days searching the net and trying to work this out so any help would be most appreciated