PHPMailer\PHPMailer

SMTP::recordLastTransactionID()protectedWP 1.0

Extract and return the ID of the last SMTP transaction based on a list of patterns provided in SMTP::$smtp_transaction_id_patterns. Relies on the host providing the ID in response to a DATA command. If no reply has been received yet, it will return null. If no pattern was matched, it will return false.

Method of the class: SMTP{}

No Hooks.

Return

true|false|String|null.

Usage

// protected - for code of main (parent) or child class
$result = $this->recordLastTransactionID();

SMTP::recordLastTransactionID() code WP 6.4.3

protected function recordLastTransactionID()
{
    $reply = $this->getLastReply();

    if (empty($reply)) {
        $this->last_smtp_transaction_id = null;
    } else {
        $this->last_smtp_transaction_id = false;
        foreach ($this->smtp_transaction_id_patterns as $smtp_transaction_id_pattern) {
            $matches = [];
            if (preg_match($smtp_transaction_id_pattern, $reply, $matches)) {
                $this->last_smtp_transaction_id = trim($matches[1]);
                break;
            }
        }
    }

    return $this->last_smtp_transaction_id;
}