Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Net::SMTP

by perlboy (Initiate)
on May 29, 2001 at 18:51 UTC ( #83963=perlquestion: print w/ replies, xml ) Need Help??
perlboy has asked for the wisdom of the Perl Monks concerning the following question:

Is there a function that indicates if a send mail operation is successful or not? Kindly look at the code snippet below:
$smtp = Net::SMTP->new(servername); $smtp->mail($ENV{REMOTE_HOST}); $smtp->to($email_address); $smtp->data(); $smtp->datasend("To: " . $what_ever); $smtp->datasend("From: name\@xxxx.com \n"); $smtp->datasend("Subject: whatever"); $smtp->datasend("\n"); $smtp->datasend($email_msg); $smtp->dataend();
can i insert a function here that indicates if operation is successful (e.g., if $email_msg is not in the mail list) $smtp->quit();
Thank you for your kind response.

Edit: chipmunk 2001-05-29

Comment on Net::SMTP
Select or Download Code
Re: Net::SMTP
by blue_cowdawg (Monsignor) on May 29, 2001 at 18:59 UTC

    Quoting directly from the Net::SMTP man page:

      Unless otherwise stated all methods return either a true or false value, with true meaning that the operation was a success. When a method states that it returns a value, failure will be returned as undef or an empty list.

    HTH


    Peter L. BergholdSchooner Technology Consulting, Inc.
    Peter@Berghold.Netwww.berghold.net
Re: Net::SMTP
by Beatnik (Parson) on May 29, 2001 at 19:08 UTC
    Check Net::Cmd's response() :
    response () Obtain a response from the server. Upon success the most signific +ant digit of the status code is returned. Upon failure, timeout etc., + undef is returned.
    since Net::SMTP is based on Net::Cmd.

    Greetz
    Beatnik
    ... Quidquid perl dictum sit, altum viditur.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://83963]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (7)
As of 2014-12-27 01:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (176 votes), past polls