Solved

How to send email to multiple address in perl script?

Posted on 2009-04-11
5
805 Views
Last Modified: 2013-12-16
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.
0
Comment
Question by:naseer6679
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 84

Assisted Solution

by:ozo
ozo earned 350 total points
ID: 24124776
That syntax alone will not send mail, unless something is doing something with STDERR
is STDERR being processed by some other program?
0
 
LVL 48

Assisted Solution

by:Tintin
Tintin earned 150 total points
ID: 24124788
The code you have given couldn't possibly send mail.  

How many addresses do you want to send to?
0
 

Author Comment

by:naseer6679
ID: 24124844
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
0
 
LVL 84

Accepted Solution

by:
ozo earned 350 total points
ID: 24127669
can you modify processv1.1?
0
 

Author Comment

by:naseer6679
ID: 24128039
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.
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question