Oihana PHP Enums

SmtpReplyCode uses ConstantsTrait

SMTP reply codes (RFC 5321 §4.2, with RFC 4954 / 7504 extensions).

The three-digit reply returned by an SMTP server after each command. The leading digit defines the outcome class:

| 2yz | Positive completion — command accepted | | 3yz | Positive intermediate — more input expected | | 4yz | Transient negative — try again later | | 5yz | Permanent negative — do not retry (bounce) |

Constants are grouped by class and ordered by value, mirroring HttpStatusCode.

SmtpReplyCode::getType    ( 250 ) ; // 'Positive Completion'
SmtpReplyCode::isTransient( 451 ) ; // true  (retry)
SmtpReplyCode::isPermanent( 550 ) ; // true  (bounce)
Tags
author

Marc Alcaraz

since
1.2.0
see
EnhancedStatusCode

For the finer-grained X.Y.Z status codes (RFC 3463).

Table of Contents

Constants

AUTH_CHALLENGE  : int = 334
AUTH_INVALID  : int = 535
AUTH_REQUIRED  : int = 530
AUTH_SUCCESSFUL  : int = 235
BAD_SEQUENCE  : int = 503
CANNOT_ACCOMMODATE_PARAMETERS  : int = 455
CANNOT_VERIFY  : int = 252
COMMAND_NOT_IMPLEMENTED  : int = 502
DOES_NOT_ACCEPT_MAIL  : int = 521
DOMAIN_DOES_NOT_ACCEPT_MAIL  : int = 556
ENCRYPTION_REQUIRED  : int = 538
EXCEEDED_STORAGE  : int = 552
HELP  : int = 214
INSUFFICIENT_STORAGE  : int = 452
LOCAL_ERROR  : int = 451
MAILBOX_NAME_NOT_ALLOWED  : int = 553
MAILBOX_NOT_FOUND  : int = 550
MAILBOX_UNAVAILABLE  : int = 450
OK  : int = 250
PARAMETER_NOT_IMPLEMENTED  : int = 504
PASSWORD_TRANSITION_NEEDED  : int = 432
SERVICE_CLOSING  : int = 221
SERVICE_NOT_AVAILABLE  : int = 421
SERVICE_READY  : int = 220
START_MAIL_INPUT  : int = 354
SYNTAX_ERROR  : int = 500
SYNTAX_ERROR_IN_PARAMETERS  : int = 501
SYSTEM_STATUS  : int = 211
TEMPORARY_AUTH_FAILURE  : int = 454
TRANSACTION_FAILED  : int = 554
USER_NOT_LOCAL  : int = 551
USER_NOT_LOCAL_WILL_FORWARD  : int = 251

Methods

getDescription()  : string|null
Returns a short human-readable description of a reply code.
getType()  : string|null
Returns the outcome class of a reply code.
isPermanent()  : bool
Whether the code is a permanent negative (`5yz`) — the message bounced and must not be retried.
isPositive()  : bool
Whether the code is positive (`2yz` completion or `3yz` intermediate).
isTransient()  : bool
Whether the code is a transient negative (`4yz`) — delivery failed for now but may succeed if retried later.

Constants

CANNOT_ACCOMMODATE_PARAMETERS

public int CANNOT_ACCOMMODATE_PARAMETERS = 455

COMMAND_NOT_IMPLEMENTED

public int COMMAND_NOT_IMPLEMENTED = 502

DOMAIN_DOES_NOT_ACCEPT_MAIL

public int DOMAIN_DOES_NOT_ACCEPT_MAIL = 556

MAILBOX_NAME_NOT_ALLOWED

public int MAILBOX_NAME_NOT_ALLOWED = 553

PARAMETER_NOT_IMPLEMENTED

public int PARAMETER_NOT_IMPLEMENTED = 504

PASSWORD_TRANSITION_NEEDED

public int PASSWORD_TRANSITION_NEEDED = 432

SERVICE_NOT_AVAILABLE

public int SERVICE_NOT_AVAILABLE = 421

SYNTAX_ERROR_IN_PARAMETERS

public int SYNTAX_ERROR_IN_PARAMETERS = 501

TEMPORARY_AUTH_FAILURE

public int TEMPORARY_AUTH_FAILURE = 454

USER_NOT_LOCAL_WILL_FORWARD

public int USER_NOT_LOCAL_WILL_FORWARD = 251

Methods

getDescription()

Returns a short human-readable description of a reply code.

public static getDescription(int|string $code) : string|null
Parameters
$code : int|string

The reply code.

Return values
string|null

The description, or null when the code is unknown.

getType()

Returns the outcome class of a reply code.

public static getType(int|string $code) : string|null
Parameters
$code : int|string

The reply code.

Return values
string|null

One of Positive Completion, Positive Intermediate, Transient Negative or Permanent Negative; null if out of range.

isPermanent()

Whether the code is a permanent negative (`5yz`) — the message bounced and must not be retried.

public static isPermanent(int|string $code) : bool
Parameters
$code : int|string

The reply code.

Return values
bool

isPositive()

Whether the code is positive (`2yz` completion or `3yz` intermediate).

public static isPositive(int|string $code) : bool
Parameters
$code : int|string

The reply code.

Return values
bool

isTransient()

Whether the code is a transient negative (`4yz`) — delivery failed for now but may succeed if retried later.

public static isTransient(int|string $code) : bool
Parameters
$code : int|string

The reply code.

Return values
bool
On this page

Search results