Link to home
Start Free TrialLog in
Avatar of naseer6679
naseer6679

asked on

How to send email to multiple address in perl script?

Hi,
I have a perl script and I use following syntax to send mail

print STDERR " email xyz\@xyz.com\n" ;

in the script.  Please let me know syntax to specify multiple email address for sending mails to more than one email address.

Thanks in advance.
Regards,
Naseer.
SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of naseer6679
naseer6679

ASKER

Hi,
Thanks for the comment.
I have one centralised server with processv1.1 file which is responsible for sending mails.genmd5 script is a perl script which is responsible for the generation of the checksum data.This part of code is in  print STDERR " email xyz\@xyz.com\n" ; genmd5 file. The checksum file is a shell script with calls the genmd5 script and sends mail to the centralised server having processv1.1 running on it to by opening a socket on specific port.
Please check the script and let me know how I can send mail by running genmd5 script to multiple email address.
Regards,
Naseer
checksum.txt
genmd5.txt.txt
Processv1.1.txt
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi Ozo,
Thanks for the reply I have to modify the processv1.1 script for the following code

$func = <stdin>;
our $mail = Net::SMTP->new ('IP ADDRESS');
our $out;
my $send_email = 0;
my $attach = 0;
my $subject;
my $priority;
my $bgcolor;
my $server;
my $module;
my $val;
my $thresh;

if ($func =~ /email (.*)/) {
      $send_email = 1;
      $subject = "Mail from  Servers";
      $attach = 1;
      push @RECIP, $1;

      while (<STDIN>) {
            $out .= $_;      
      }


but the thing is I am not good with perl scripting and I dont know how to do looping for sending mails to multiple address. If you can suggest me that would be great.This whole process script is not made by me.

Thanks.
Naseer.