Solved

How to send email to multiple address in perl script?

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to get all the API from website? 11 104
OpenLDAP Proxy to Active Directy 6 361
cron job says it ran, no results 25 120
Write an app 10 70
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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…

808 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