sending mail in perl.. No errors and also no output


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting sending mail in perl.. No errors and also no output
# 1  
Old 07-30-2012
sending mail in perl.. No errors and also no output

Hi folks,

I am trying to send an email in Perl script with the below code.
I have written the code in Padre IDE and installed all the required modules(Mail::Sendmail) and executed the code.

It is neither showing errors nor giving the output. I havnt received an mail after running the below code. Also it is not showing any warnings.

Code:
use warnings;
use strict;
use Mail::Sendmail;
my $MailFrom = 'someone@example.com;
my $to_list  = 'someone@example.com';
my $cc_list  = 'someone_2@example.com';
my $subject  = "From giridhar....";
my $message  = "This email was generated automatically.\n";
sendmail(
    Smtp => 'mailtest.gmail.com',
    From    => $MailFrom,
    To      => $to_list,
    Cc      => $cc_list,
    Subject => $subject,
    Message => $message,
);

Requesting all the big heads to help me in this regard.

---------- Post updated at 08:37 AM ---------- Previous update was at 08:29 AM ----------

Also I have tried with below code but no luck...(confirming that I have installed Email::Send module)

Code:
use Email::Send;    
my $message = q(From: someone@example.com  
To: someone_2@example.com  
Subject: Whats up?    
See, I mailed you through my program.  
);  
Email::Send->new({mailer => 'Sendmail'})->send($message);

The code got executed but still havnt received any mail.
Dont know where I made the mistake.
I am using Padre IDE for executing the codes.

Could anyone please help me ?

Thanks in advance

---------- Post updated at 08:49 PM ---------- Previous update was at 08:37 AM ----------

Could anyone please help me out ??

Last edited by Scott; 07-30-2012 at 10:48 AM.. Reason: Code tags, please; removed email addresses
# 2  
Old 08-02-2012
Perhaps start by checking that works when you do it via a telnet localhost 25 and/or running sendmail direct form the commandline.
Also, check the system mail logs to see if the message is getting anywhere near the mail system.
Also check on the return code from those final send commands - at least you'll then know if it thinks it worked.
This User Gave Thanks to Smiling Dragon For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sending errors via mail

Hey guys. I have created a script that mounts an external folder via sshfd, counts the number of files then do some delete and then counts the files again to get how many files have been deleted. Then it sends the resault by mail. My question is, how can i send via mail the errors on this... (2 Replies)
Discussion started by: Pizza
2 Replies

2. Red Hat

Problems sending mail: Difference between Mail and Mailx?

Whats the difference between mail and mailx? I'm trying to troubleshoot a problem where I can send mail from server A with this `echo $MESSAGE | mail -s "$SUBJECT" -r $FROM $RECIPIENTS` command but executing the same command from server B throws me this error (Both servers are RHEL) ... (1 Reply)
Discussion started by: RedSpyder
1 Replies

3. UNIX for Dummies Questions & Answers

Sending mail

How can i send a mail when user login in unix ENV. How can i know present use mailID?? Moved out of Contact Us Forum - Please Do Not Post Technical Questions in Non-Technical Forum(s) (1 Reply)
Discussion started by: arun508.gatike
1 Replies

4. Shell Programming and Scripting

Stop sending mail after certain number of mail

Hi guys... I am busy writing a script to notify me via an mail if my application is down. I have done that. Now I want this script to stop sending mails after five mails were sent but the script should keep on checking the application. When the application is up again that count should be... (5 Replies)
Discussion started by: Phuti
5 Replies

5. AIX

errpt kept sending errors after disk replacement

Hi, The system is a Power6 8204 with an external storage 7031. OS is AIX 5.3. I replaced a failed disk hdisk28 and put it back to the volume group. Everything looks just fine. After the replacement, errpt has kept sending "Perm DISK OPERATION ERROR". Other than the error, everything still... (1 Reply)
Discussion started by: aixlover
1 Replies

6. UNIX and Linux Applications

Got Errors while sending a transaction through ESB

We are getting below error when processing a transaction through ESB. I work for SOA admin and checked the JCA connection is working fine also code also working fine in other envs. An unhandled exception has been thrown in the ESB system. The exception reported is:... (1 Reply)
Discussion started by: KuldeepSinghTCS
1 Replies

7. Shell Programming and Scripting

sending mail from perl using mailx

hi All, i am trying to send a mail from perl using mailx. the script runs fine if i hard code the file path which is to be attached to the mail. but when i give a variable containing the path of the file , perl is not able to send the file. ex: system('uuencode /attach/test.txt... (3 Replies)
Discussion started by: adityamahi
3 Replies

8. Shell Programming and Scripting

sending mail using perl through windows

Hi all this is the code which i tried executing in windows environment to send a test mail. # Perl script to send mail on deliver complete. package SendMail; use Config; use Mail::Send; @ISA = qw(Mail::Send); sub open { my $me = shift; my $how; # How to send mail my $notused; my... (13 Replies)
Discussion started by: victorvvk
13 Replies

9. Shell Programming and Scripting

Sending mail from Unix - For html output

I have automated some checks - and I want to send a email when there is an issue. This is fine and I can send the email. However - I want to generate the email in html format so I can highlight any issues to a reader.. ie. If there is a disk space issue - then the email will highlight the... (2 Replies)
Discussion started by: frustrated1
2 Replies

10. UNIX for Dummies Questions & Answers

sending a mail to a mail client

Hi everyone! I'm trying to create a database monitoring script that reads an alert file and sends an error message if it can 'grep' a particular string. Is there a way to send this message to a mail client using SMTP? Even better, is there any place on this site that has these kinds of... (5 Replies)
Discussion started by: solaris73
5 Replies
Login or Register to Ask a Question