Solved

How to send email to multiple address in perl script?

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Perl modules on linux ec2 3 104
Linux :how to provide sudo access to the user 13 97
Python Assistance 7 81
Linux "time" command output redirection 16 146
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
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.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

777 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