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.

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)

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 ??

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.

1 Like