Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Trapping server responses with Net::SMTP

by fivefiftyone (Acolyte)
on Oct 21, 2008 at 17:59 UTC ( [id://718552]=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    Net::Cmd->code()
    Net::Cmd->message()
    
  2. or download this
    # Create ourselves an SMTP object
    my $smtp = Net::SMTP->new(
    ...
    $smtp->to("youthere\@mailserver.de")
       or die "Error on RCPT TO: ", $smtp->code(), " ", $smtp->message();
    $smtp->quit;
    
  3. or download this
    $smtp->mail("postmaster\@mailserver.co.za", Size => 52428800);
    if ( $smtp->status() =~ /^[45]$/ ) {
       # informative error here
       exit(1);
    }
    
  4. or download this
    if ( $smtp->status() =~ /^[45]$/ ) {
       if ( $smtp->message() eq "size limit exceeded" ) {
    ...
          print "The message is too big. Boo-hoo\n";
       }
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://718552]
Approved by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2024-04-18 12:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found