kalyanbhave has asked for the wisdom of the Perl Monks concerning the following question:

Hi , I am not able to send an email using this script.And its wierd not showing me any error...
use Net::SMTP; #Create a new object with 'new'. $smtp = Net::SMTP->new("xxxx.com"); #Send the MAIL command to the server. $smtp->mail("xxx.com"); #Send the server the 'Mail To' address. $smtp->to("xxx.com"); #Start the message. $smtp->data(); #Send the message. $smtp->datasend("Hello World!\n\n"); #End the message. $smtp->dataend(); #Close the connection to your server. $smtp->quit();

Replies are listed 'Best First'.
Re: Not able to send an email using this command
by marto (Cardinal) on Sep 06, 2012 at 09:51 UTC

    Also consider enabling debugging (read Net::SMTP), consider checking the mail server logs.

    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Not able to send an email using this command
by prashantktyagi (Scribe) on Sep 06, 2012 at 09:44 UTC
    Try Perl special variable($!, $@) to capture error or use eval block.