Solved

How to send email to multiple address in perl script?

Posted on 2009-04-11
5
796 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
  • 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

706 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now