Sponsored Content
Top Forums Shell Programming and Scripting not able to send the mail through perl script Post 302670213 by giridhar276 on Thursday 12th of July 2012 02:12:47 AM
Old 07-12-2012
not able to send the mail through perl script

I have written small piece of code to send mail through perl script.Below is the code.I have executed it as #
perl perlmail.pl and the code got executed with no errors.
Still have not received any mail.
Also I have installed Mail::send module from CPAN directly but no luck.
Could any mail please share your views on this?

#!/usr/bin/perl -w
use Mail::Send;
my $msg = new Mail::Send;
my $time = localtime();
$msg->to( 'girdhar.sripathi@gmail.com') || die "mail not sent";
$msg->cc( 'giridhar276@gmail.com');
$msg->subject("Webserver is down! ($time)");
my $fh = $msg->open;
$fh->close;
# complete the message and send it

---------- Post updated at 09:49 PM ---------- Previous update was at 09:46 PM ----------

Also I have tried with the below code still no luck.Code got executed but havnt received any sort of mail.

#!/usr/bin/perl
$path_to_sendmail = '/usr/sbin/sendmail -t';
# this is the usual location of the sendmail program,
# see if your's is somewhere else
open MAIL,"|$path_to_sendmail"; # open a pipe to da program
print MAIL q(From: giridhar.sripathi@gmail.com
To: giridhar276@gmail.com
Subject: Whats up?

See, I mailed you through my program.
);

---------- Post updated 07-12-12 at 01:12 AM ---------- Previous update was 07-11-12 at 09:49 PM ----------

any help on this will be highly appreciated.

Regards,
Giridhar
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to send a mail in UNIX

Hi, I need to write one unix script gor sending a mail notification. I have to pass the followinf as arguments,from ,to,subject,messege body Can i use mailx....Please provide the code Thanks in advance. (1 Reply)
Discussion started by: sudhi
1 Replies

2. Shell Programming and Scripting

shell script to send a mail

Hi, I need a shell script which runs in the backround for all the 24 hours and send a mail to us regarding the output of the prstat command when the load average increase above certain percent. kindly help me on this...... (1 Reply)
Discussion started by: jayaramanit
1 Replies

3. Shell Programming and Scripting

script to send mail from unix??

Hi all, I wrote a shell script to send a mail, it is not showing any errors but i didn't receive any mail #!/bin/ksh . ./set_mail_details.ksh echo 'In script' subject=$1 echo '\nsubject' echo $1 echo "$subject" | sed 's/~/ /g' | read sub body_of_email=$2 echo '\nBody' echo $2... (7 Replies)
Discussion started by: deepaknbk
7 Replies

4. UNIX for Advanced & Expert Users

need to configure mail setting to send mail to outlook mail server

i have sun machines having solaris 9 & 10 OS . Now i need to send mail from the machines to my outlook account . I have the ip adress of OUTLOOK mail server. Now what are the setting i need to do in solaris machines so that i can use mailx or sendmail. actually i am trying to automate the high... (2 Replies)
Discussion started by: amitranjansahu
2 Replies

5. Shell Programming and Scripting

Help-send mail script

Hi, I have written one script for sending mails with attachment. currently its working for only one recipient. I want to send mails to n number of users by taking user input i.e number of users. Output of current script: Enter how many files : 1 Enter First Name : kiran E-Mail... (2 Replies)
Discussion started by: kiran_j
2 Replies

6. Shell Programming and Scripting

script to send mail !!

Hi Experts.. i have created a table with the fields, empid name mailid 1 raja raja@xy.com and entered the values of all persons who are in that file... i have a .csv file date shift1 shift2 6/6/2011 ram raja Now i want a script that could fetch the data in (input file .csv file) and... (3 Replies)
Discussion started by: cratercrabs
3 Replies

7. Shell Programming and Scripting

Send mail using perl cgi

hi everyone , i want to send e-mail using Perl CGI. i am new to Perl please tell me the solution. I dont have any idea about sending mail through Perl : Please can you give me appropriate code for sending the mail Please help me out....??? (1 Reply)
Discussion started by: Navrattan Bansa
1 Replies

8. Shell Programming and Scripting

Perl: Send mail via SMTP

I have a existing perl program , in this program it will output a email address list to a variable ( $email_list ) , mail content to a variable ( $email_content ) , if I want to send all email to these email address with corresponding content , would aadivse how to write a perl script ? thanks (2 Replies)
Discussion started by: ust3
2 Replies

9. Shell Programming and Scripting

A shell script to run a script which don't get terminated and send a pattern from the output by mail

Hi Guys, I am very new to shell script and I need your help here to write a script. Actually, I have a script abc.sh which don't get terminated itself. So I need to design a script to run this script, save the output to a file, search for a given string in the output and if it exists send those... (11 Replies)
Discussion started by: Sambit Sahu
11 Replies

10. UNIX for Advanced & Expert Users

Client was not authenticated to send anonymous mail during MAIL FROM (in reply to MAIL FROM comm

I am having trouble getting mail to work on a red hat server. At first I was getting this message. Diagnostic-Code: X-Postfix; delivery temporarily suspended: connect to :25: Connection refused Then added the port to my firewall. Then I temporarily turned off selinux. I then copied this file... (1 Reply)
Discussion started by: cokedude
1 Replies
MATCHERRC2PERLFILTER.PL(1)				User Contributed Perl Documentation				MATCHERRC2PERLFILTER.PL(1)

NAME
matcherrc2perlfilter -- Conversion of matcherrc rules to perl DESCRIPTION
This script converts matcherrc filtering rules into perl_filter rules for usage with the claws-mail-perl-filter plugin of the Claws Mail mailer. USAGE
matcherrc2perlfilter No arguments required. Conversion is done for current user only. FILES
$HOME/.claws-mail/matcherrc Input file where standard filtering rules lie. $HOME/.claws-mail/perl_filter Output file written by this script. Converted rules are appended if the file already exists, so be careful when running the script more than once. BUGS
This conversion script doesn't produce nice Perl code and is just intended to get you started. If you choose to use the Perl plugin, consider rewriting your rules. SEE ALSO
claws-mail-perl-filter(1), claws-mail(1) AUTHOR
This manual page was written by Ricardo Mones <mones@debian.org>, for the Debian GNU/Linux system (but may be used by others). The matcherrc2perlfilter was written by Holger Berndt <berndth@gmx.de>. perl v5.14.2 2012-11-17 MATCHERRC2PERLFILTER.PL(1)
All times are GMT -4. The time now is 05:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy