Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
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 perusing the Monastery: (2)
As of 2024-06-22 22:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.