function SMTP::recordLastTransactionID

5.x SMTP.php protected SMTP::recordLastTransactionID()

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.

Return value

bool|null|string

File

inc/PHPMailer/src/SMTP.php, line 1315

Class

SMTP
PHPMailer RFC821 SMTP email transport class. Implements RFC 821 SMTP commands and provides some utility methods for sending mail to an SMTP server.

Code

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) {
      if (preg_match($smtp_transaction_id_pattern, $reply, $matches)) {
        $this->last_smtp_transaction_id = trim($matches[1]);
        break;
      }
    }
  }

  return $this->last_smtp_transaction_id;
}