Sisimai::SMTP::Status(3pm)

NAME
Sisimai::SMTP::Status - SMTP Enhanced Status Codes related utilities

SYNOPSIS
    use Sisimai::SMTP::Status;
    print Sisimai::SMTP::Status->code('userunknown');           # '5.9.213'
    print Sisimai::SMTP::Status->name('5.1.2');                 # 'hostunknown'
    print Sisimai::SMTP::Status->find('550 5.1.1 Unknown user');# '5.1.1'

DESCRIPTION
"Sisimai::SMTP::Status" is a utility class for getting the DSN value from the error reason text, getting the reason from the DSN value, and getting the DSN from the text including a DSN.

CLASS METHODS

  "code(reason,temp)"
code() method returns pseudo DSN value from the specified reason string. The second argument is a flag for getting pseudo DSN value as a temporary error.

    print Sisimai::SMTP::Status->code('mailboxfull');   # '5.9.220'
    print Sisimai::SMTP::Status->code('mailboxfull',1); # '4.9.220'

  "name(D.S.N.)"
name() method returns the reason string from the specified DSN value.

    print Sisimai::SMTP::Status->name('5.1.6');         # 'hasmoved'
    print Sisimai::SMTP::Status->name('4.2.3');         # 'emailtoolarge'

  "test(D.S.N.)"
test() method checks whether the status code is a valid code or not.

    print Sisimai::SMTP::Status->test('5.1.6'); # 1
    print Sisimai::SMTP::Status->test('3.14');  # 0

  "find(String, String)"
find() method returns the DSN value only from the text including a DSN

    print Sisimai::SMTP::Status->find('5.0.0');                  # '5.0.0'
    print Sisimai::SMTP::Status->find('550 5.1.1 User unknown'); # '5.1.1'
    print Sisimai::SMTP::Status->find('447 delivery expired');   # ''

  "prefer(Code in Status: field, Code in an error message, [Reply code])"
prefer() method returns the preferred value selected from the arguments.

    print Sisimai::SMTP::Status->prefer("5.2.1", "5.0.0");      # "5.2.1"
    print Sisimai::SMTP::Status->prefer("4.4.7", "5.1.1", 421); # "4.4.7"

  "is_explicit(delivery status code)"
is_explicit() method returns 0 if the delivery status code is empty or is an internal code

    print Sisimai::SMTP::Status->is_explicit("5.9.301"); # 0
    print Sisimai::SMTP::Status->is_explicit("5.7.625"); # 1

  "is_ambiguous(delivery status code)"
is_ambiguous() method returns 1 if the delivery status code is not empty and ends with ".0.0".

    print Sisimai::SMTP::Status->is_ambiguous("5.0.0"); # 1
    print Sisimai::SMTP::Status->is_ambiguous("");      # 1
    print Sisimai::SMTP::Status->is_ambiguous("4.7.7"); # 0

AUTHOR
azumakuniyuki

COPYRIGHT
Copyright (C) 2015-2018,2020-2026 azumakuniyuki, All rights reserved.

LICENSE
This software is distributed under The BSD 2-Clause License.

POD ERRORS
Hey! The above document had some coding errors, which are explained below:

Around line 918:
    Unterminated C<B<...>> sequence

Around line 925:
    Unterminated C<B<...>> sequence