Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php namespace PHPMailer\PHPMailer; class SMTP { const VERSION = "\x36\x2e\x39\x2e\61"; ..

Decoded Output download

<?php
 namespace PHPMailer\PHPMailer; class SMTP { const VERSION = "6.9.1"; const LE = "
"; const DEFAULT_PORT = 25; const DEFAULT_SECURE_PORT = 465; const MAX_LINE_LENGTH = 998; const MAX_REPLY_LENGTH = 512; const DEBUG_OFF = 0; const DEBUG_CLIENT = 1; const DEBUG_SERVER = 2; const DEBUG_CONNECTION = 3; const DEBUG_LOWLEVEL = 4; public $do_debug = self::DEBUG_OFF; public $Debugoutput = "echo"; public $do_verp = false; public $Timeout = 300; public $Timelimit = 300; protected $smtp_transaction_id_patterns = array("exim" => "/[\d]{3} OK id=(.*)/", "sendmail" => "/[\d]{3} 2\.0\.0 (.*) Message/", "postfix" => "/[\d]{3} 2\.0\.0 Ok: queued as (.*)/", "Microsoft_ESMTP" => "/[0-9]{3} 2\.[\d]\.0 (.*)@(?:.*) Queued mail for delivery/", "Amazon_SES" => "/[\d]{3} Ok (.*)/", "SendGrid" => "/[\d]{3} Ok: queued as (.*)/", "CampaignMonitor" => "/[\d]{3} 2\.0\.0 OK:([a-zA-Z\d]{48})/", "Haraka" => "/[\d]{3} Message Queued \((.*)\)/", "ZoneMTA" => "/[\d]{3} Message queued as (.*)/", "Mailjet" => "/[\d]{3} OK queued as (.*)/"); public static $xclient_allowed_attributes = array("NAME", "ADDR", "PORT", "PROTO", "HELO", "LOGIN", "DESTADDR", "DESTPORT"); protected $last_smtp_transaction_id; protected $smtp_conn; protected $error = array("error" => '', "detail" => '', "smtp_code" => '', "smtp_code_ex" => ''); protected $helo_rply; protected $server_caps; protected $last_reply = ''; protected function edebug($str, $level = 0) { if ($level > $this->do_debug) { return; } if ($this->Debugoutput instanceof \Psr\Log\LoggerInterface) { $this->Debugoutput->debug($str); return; } if (is_callable($this->Debugoutput) && !in_array($this->Debugoutput, array("error_log", "html", "echo"))) { call_user_func($this->Debugoutput, $str, $level); return; } switch ($this->Debugoutput) { case "error_log": error_log($str); break; case "html": echo gmdate("Y-m-d H:i:s"), " ", htmlentities(preg_replace("/[\r\n]+/", '', $str), ENT_QUOTES, "UTF-8"), "<br>\xa"; break; case "echo": default: $str = preg_replace("/\r\n|\r/m", "\xa", $str); echo gmdate("Y-m-d H:i:s"), "\x9", trim(str_replace("
", "
                   \x9                  ", trim($str))), "\xa"; } } public function connect($host, $port = null, $timeout = 30, $options = array()) { $this->setError(''); if ($this->connected()) { $this->setError("Already connected to a server"); return false; } if (empty($port)) { $port = self::DEFAULT_PORT; } $this->edebug("Connection: opening to {$host}:{$port}, timeout={$timeout}, options=" . (count($options) > 0 ? var_export($options, true) : "array()"), self::DEBUG_CONNECTION); $this->smtp_conn = $this->getSMTPConnection($host, $port, $timeout, $options); if ($this->smtp_conn === false) { return false; } $this->edebug("Connection: opened", self::DEBUG_CONNECTION); $this->last_reply = $this->get_lines(); $this->edebug("SERVER -> CLIENT: " . $this->last_reply, self::DEBUG_SERVER); $responseCode = (int) substr($this->last_reply, 0, 3); if ($responseCode === 220) { return true; } if ($responseCode === 554) { $this->quit(); } $this->edebug("Connection: closing due to error", self::DEBUG_CONNECTION); $this->close(); return false; } protected function getSMTPConnection($host, $port = null, $timeout = 30, $options = array()) { static $streamok; if (null === $streamok) { $streamok = function_exists("stream_socket_client"); } $errno = 0; $errstr = ''; if ($streamok) { $socket_context = stream_context_create($options); set_error_handler(array($this, "errorHandler")); $connection = stream_socket_client($host . ":" . $port, $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT, $socket_context); } else { $this->edebug("Connection: stream_socket_client not available, falling back to fsockopen", self::DEBUG_CONNECTION); set_error_handler(array($this, "errorHandler")); $connection = fsockopen($host, $port, $errno, $errstr, $timeout); } restore_error_handler(); if (!is_resource($connection)) { $this->setError("Failed to connect to server", '', (string) $errno, $errstr); $this->edebug("SMTP ERROR: " . $this->error["error"] . ": {$errstr} ({$errno})", self::DEBUG_CLIENT); return false; } if (strpos(PHP_OS, "WIN") !== 0) { $max = (int) ini_get("max_execution_time"); if (0 !== $max && $timeout > $max && strpos(ini_get("disable_functions"), "set_time_limit") === false) { @set_time_limit($timeout); } stream_set_timeout($connection, $timeout, 0); } return $connection; } public function startTLS() { if (!$this->sendCommand("STARTTLS", "STARTTLS", 220)) { return false; } $crypto_method = STREAM_CRYPTO_METHOD_TLS_CLIENT; if (defined("STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT")) { $crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT; $crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT; } set_error_handler(array($this, "errorHandler")); $crypto_ok = stream_socket_enable_crypto($this->smtp_conn, true, $crypto_method); restore_error_handler(); return (bool) $crypto_ok; } public function authenticate($username, $password, $authtype = null, $OAuth = null) { if (!$this->server_caps) { $this->setError("Authentication is not allowed before HELO/EHLO"); return false; } if (array_key_exists("EHLO", $this->server_caps)) { if (!array_key_exists("AUTH", $this->server_caps)) { $this->setError("Authentication is not allowed at this stage"); return false; } $this->edebug("Auth method requested: " . ($authtype ?: "UNSPECIFIED"), self::DEBUG_LOWLEVEL); $this->edebug("Auth methods available on the server: " . implode(",", $this->server_caps["AUTH"]), self::DEBUG_LOWLEVEL); if (null !== $authtype && !in_array($authtype, $this->server_caps["AUTH"], true)) { $this->edebug("Requested auth method not available: " . $authtype, self::DEBUG_LOWLEVEL); $authtype = null; } if (empty($authtype)) { foreach (array("CRAM-MD5", "LOGIN", "PLAIN", "XOAUTH2") as $method) { if (in_array($method, $this->server_caps["AUTH"], true)) { $authtype = $method; break; } } if (empty($authtype)) { $this->setError("No supported authentication methods found"); return false; } $this->edebug("Auth method selected: " . $authtype, self::DEBUG_LOWLEVEL); } if (!in_array($authtype, $this->server_caps["AUTH"], true)) { $this->setError("The requested authentication method "{$authtype}" is not supported by the server"); return false; } } elseif (empty($authtype)) { $authtype = "LOGIN"; } switch ($authtype) { case "PLAIN": if (!$this->sendCommand("AUTH", "AUTH PLAIN", 334)) { return false; } if (!$this->sendCommand("User & Password", base64_encode("\x0" . $username . "\x0" . $password), 235)) { return false; } break; case "LOGIN": if (!$this->sendCommand("AUTH", "AUTH LOGIN", 334)) { return false; } if (!$this->sendCommand("Username", base64_encode($username), 334)) { return false; } if (!$this->sendCommand("Password", base64_encode($password), 235)) { return false; } break; case "CRAM-MD5": if (!$this->sendCommand("AUTH CRAM-MD5", "AUTH CRAM-MD5", 334)) { return false; } $challenge = base64_decode(substr($this->last_reply, 4)); $response = $username . " " . $this->hmac($challenge, $password); return $this->sendCommand("Username", base64_encode($response), 235); case "XOAUTH2": if (null === $OAuth) { return false; } $oauth = $OAuth->getOauth64(); if (!$this->sendCommand("AUTH", "AUTH XOAUTH2 " . $oauth, 235)) { return false; } break; default: $this->setError("Authentication method "{$authtype}" is not supported"); return false; } return true; } protected function hmac($data, $key) { if (function_exists("hash_hmac")) { return hash_hmac("md5", $data, $key); } $bytelen = 64; if (strlen($key) > $bytelen) { $key = pack("H*", md5($key)); } $key = str_pad($key, $bytelen, chr(0)); $ipad = str_pad('', $bytelen, chr(54)); $opad = str_pad('', $bytelen, chr(92)); $k_ipad = $key ^ $ipad; $k_opad = $key ^ $opad; return md5($k_opad . pack("H*", md5($k_ipad . $data))); } public function connected() { if (is_resource($this->smtp_conn)) { $sock_status = stream_get_meta_data($this->smtp_conn); if ($sock_status["eof"]) { $this->edebug("SMTP NOTICE: EOF caught while checking if connected", self::DEBUG_CLIENT); $this->close(); return false; } return true; } return false; } public function close() { $this->server_caps = null; $this->helo_rply = null; if (is_resource($this->smtp_conn)) { fclose($this->smtp_conn); $this->smtp_conn = null; $this->edebug("Connection: closed", self::DEBUG_CONNECTION); } } public function data($msg_data) { if (!$this->sendCommand("DATA", "DATA", 354)) { return false; } $lines = explode("\xa", str_replace(array("
", "\xd"), "\xa", $msg_data)); $field = substr($lines[0], 0, strpos($lines[0], ":")); $in_headers = false; if (!empty($field) && strpos($field, " ") === false) { $in_headers = true; } foreach ($lines as $line) { $lines_out = array(); if ($in_headers && $line === '') { $in_headers = false; } while (isset($line[self::MAX_LINE_LENGTH])) { $pos = strrpos(substr($line, 0, self::MAX_LINE_LENGTH), " "); if (!$pos) { $pos = self::MAX_LINE_LENGTH - 1; $lines_out[] = substr($line, 0, $pos); $line = substr($line, $pos); } else { $lines_out[] = substr($line, 0, $pos); $line = substr($line, $pos + 1); } if ($in_headers) { $line = "	" . $line; } } $lines_out[] = $line; foreach ($lines_out as $line_out) { if (!empty($line_out) && $line_out[0] === ".") { $line_out = "." . $line_out; } $this->client_send($line_out . static::LE, "DATA"); } } $savetimelimit = $this->Timelimit; $this->Timelimit *= 2; $result = $this->sendCommand("DATA END", ".", 250); $this->recordLastTransactionID(); $this->Timelimit = $savetimelimit; return $result; } public function hello($host = '') { if ($this->sendHello("EHLO", $host)) { return true; } if (substr($this->helo_rply, 0, 3) == "421") { return false; } return $this->sendHello("HELO", $host); } protected function sendHello($hello, $host) { $noerror = $this->sendCommand($hello, $hello . " " . $host, 250); $this->helo_rply = $this->last_reply; if ($noerror) { $this->parseHelloFields($hello); } else { $this->server_caps = null; } return $noerror; } protected function parseHelloFields($type) { $this->server_caps = array(); $lines = explode("\xa", $this->helo_rply); foreach ($lines as $n => $s) { $s = trim(substr($s, 4)); if (empty($s)) { continue; } $fields = explode(" ", $s); if (!empty($fields)) { if (!$n) { $name = $type; $fields = $fields[0]; } else { $name = array_shift($fields); switch ($name) { case "SIZE": $fields = $fields ? $fields[0] : 0; break; case "AUTH": if (!is_array($fields)) { $fields = array(); } break; default: $fields = true; } } $this->server_caps[$name] = $fields; } } } public function mail($from) { $useVerp = $this->do_verp ? " XVERP" : ''; return $this->sendCommand("MAIL FROM", "MAIL FROM:<" . $from . ">" . $useVerp, 250); } public function quit($close_on_error = true) { $noerror = $this->sendCommand("QUIT", "QUIT", 221); $err = $this->error; if ($noerror || $close_on_error) { $this->close(); $this->error = $err; } return $noerror; } public function recipient($address, $dsn = '') { if (empty($dsn)) { $rcpt = "RCPT TO:<" . $address . ">"; } else { $dsn = strtoupper($dsn); $notify = array(); if (strpos($dsn, "NEVER") !== false) { $notify[] = "NEVER"; } else { foreach (array("SUCCESS", "FAILURE", "DELAY") as $value) { if (strpos($dsn, $value) !== false) { $notify[] = $value; } } } $rcpt = "RCPT TO:<" . $address . "> NOTIFY=" . implode(",", $notify); } return $this->sendCommand("RCPT TO", $rcpt, array(250, 251)); } public function xclient(array $vars) { $xclient_options = ''; foreach ($vars as $key => $value) { if (in_array($key, SMTP::$xclient_allowed_attributes)) { $xclient_options .= " {$key}={$value}"; } } if (!$xclient_options) { return true; } return $this->sendCommand("XCLIENT", "XCLIENT" . $xclient_options, 250); } public function reset() { return $this->sendCommand("RSET", "RSET", 250); } protected function sendCommand($command, $commandstring, $expect) { if (!$this->connected()) { $this->setError("Called {$command} without being connected"); return false; } if (strpos($commandstring, "\xa") !== false || strpos($commandstring, "
") !== false) { $this->setError("Command '{$command}' contained line breaks"); return false; } $this->client_send($commandstring . static::LE, $command); $this->last_reply = $this->get_lines(); $matches = array(); if (preg_match("/^([\d]{3})[ -](?:([\d]\.[\d]\.[\d]{1,2}) )?/", $this->last_reply, $matches)) { $code = (int) $matches[1]; $code_ex = count($matches) > 2 ? $matches[2] : null; $detail = preg_replace("/{$code}[ -]" . ($code_ex ? str_replace(".", "\.", $code_ex) . " " : '') . "/m", '', $this->last_reply); } else { $code = (int) substr($this->last_reply, 0, 3); $code_ex = null; $detail = substr($this->last_reply, 4); } $this->edebug("SERVER -> CLIENT: " . $this->last_reply, self::DEBUG_SERVER); if (!in_array($code, (array) $expect, true)) { $this->setError("{$command} command failed", $detail, $code, $code_ex); $this->edebug("SMTP ERROR: " . $this->error["error"] . ": " . $this->last_reply, self::DEBUG_CLIENT); return false; } if ($command !== "RSET") { $this->setError(''); } return true; } public function sendAndMail($from) { return $this->sendCommand("SAML", "SAML FROM:{$from}", 250); } public function verify($name) { return $this->sendCommand("VRFY", "VRFY {$name}", array(250, 251)); } public function noop() { return $this->sendCommand("NOOP", "NOOP", 250); } public function turn() { $this->setError("The SMTP TURN command is not implemented"); $this->edebug("SMTP NOTICE: " . $this->error["error"], self::DEBUG_CLIENT); return false; } public function client_send($data, $command = '') { if (self::DEBUG_LOWLEVEL > $this->do_debug && in_array($command, array("User & Password", "Username", "Password"), true)) { $this->edebug("CLIENT -> SERVER: [credentials hidden]", self::DEBUG_CLIENT); } else { $this->edebug("CLIENT -> SERVER: " . $data, self::DEBUG_CLIENT); } set_error_handler(array($this, "errorHandler")); $result = fwrite($this->smtp_conn, $data); restore_error_handler(); return $result; } public function getError() { return $this->error; } public function getServerExtList() { return $this->server_caps; } public function getServerExt($name) { if (!$this->server_caps) { $this->setError("No HELO/EHLO was sent"); return null; } if (!array_key_exists($name, $this->server_caps)) { if ("HELO" === $name) { return $this->server_caps["EHLO"]; } if ("EHLO" === $name || array_key_exists("EHLO", $this->server_caps)) { return false; } $this->setError("HELO handshake was used; No information about server extensions available"); return null; } return $this->server_caps[$name]; } public function getLastReply() { return $this->last_reply; } protected function get_lines() { if (!is_resource($this->smtp_conn)) { return ''; } $data = ''; $endtime = 0; stream_set_timeout($this->smtp_conn, $this->Timeout); if ($this->Timelimit > 0) { $endtime = time() + $this->Timelimit; } $selR = array($this->smtp_conn); $selW = null; while (is_resource($this->smtp_conn) && !feof($this->smtp_conn)) { set_error_handler(array($this, "errorHandler")); $n = stream_select($selR, $selW, $selW, $this->Timelimit); restore_error_handler(); if ($n === false) { $message = $this->getError()["detail"]; $this->edebug("SMTP -> get_lines(): select failed (" . $message . ")", self::DEBUG_LOWLEVEL); if (stripos($message, "interrupted system call") !== false) { $this->edebug("SMTP -> get_lines(): retrying stream_select", self::DEBUG_LOWLEVEL); $this->setError(''); continue; } break; } if (!$n) { $this->edebug("SMTP -> get_lines(): select timed-out in (" . $this->Timelimit . " sec)", self::DEBUG_LOWLEVEL); break; } $str = @fgets($this->smtp_conn, self::MAX_REPLY_LENGTH); $this->edebug("SMTP INBOUND: "" . trim($str) . """, self::DEBUG_LOWLEVEL); $data .= $str; if (!isset($str[3]) || $str[3] === " " || $str[3] === "
" || $str[3] === "\xa") { break; } $info = stream_get_meta_data($this->smtp_conn); if ($info["timed_out"]) { $this->edebug("SMTP -> get_lines(): stream timed-out (" . $this->Timeout . " sec)", self::DEBUG_LOWLEVEL); break; } if ($endtime && time() > $endtime) { $this->edebug("SMTP -> get_lines(): timelimit reached (" . $this->Timelimit . " sec)", self::DEBUG_LOWLEVEL); break; } } return $data; } public function setVerp($enabled = false) { $this->do_verp = $enabled; } public function getVerp() { return $this->do_verp; } protected function setError($message, $detail = '', $smtp_code = '', $smtp_code_ex = '') { $this->error = array("error" => $message, "detail" => $detail, "smtp_code" => $smtp_code, "smtp_code_ex" => $smtp_code_ex); } public function setDebugOutput($method = "echo") { $this->Debugoutput = $method; } public function getDebugOutput() { return $this->Debugoutput; } public function setDebugLevel($level = 0) { $this->do_debug = $level; } public function getDebugLevel() { return $this->do_debug; } public function setTimeout($timeout = 0) { $this->Timeout = $timeout; } public function getTimeout() { return $this->Timeout; } protected function errorHandler($errno, $errmsg, $errfile = '', $errline = 0) { $notice = "Connection failed."; $this->setError($notice, $errmsg, (string) $errno); $this->edebug("{$notice} Error #{$errno}: {$errmsg} [{$errfile} line {$errline}]", self::DEBUG_CONNECTION); } 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 = array(); if (preg_match($smtp_transaction_id_pattern, $reply, $matches)) { $this->last_smtp_transaction_id = trim($matches[1]); break; } } } return $this->last_smtp_transaction_id; } public function getLastTransactionID() { return $this->last_smtp_transaction_id; } } ?>

Did this file decode correctly?

Original Code

<?php
 namespace PHPMailer\PHPMailer; class SMTP { const VERSION = "\x36\x2e\x39\x2e\61"; const LE = "\15\12"; const DEFAULT_PORT = 25; const DEFAULT_SECURE_PORT = 465; const MAX_LINE_LENGTH = 998; const MAX_REPLY_LENGTH = 512; const DEBUG_OFF = 0; const DEBUG_CLIENT = 1; const DEBUG_SERVER = 2; const DEBUG_CONNECTION = 3; const DEBUG_LOWLEVEL = 4; public $do_debug = self::DEBUG_OFF; public $Debugoutput = "\x65\143\150\x6f"; public $do_verp = false; public $Timeout = 300; public $Timelimit = 300; protected $smtp_transaction_id_patterns = array("\x65\x78\151\155" => "\57\133\x5c\144\x5d\x7b\x33\175\x20\x4f\x4b\40\x69\144\75\50\x2e\x2a\x29\x2f", "\163\145\x6e\x64\155\x61\x69\x6c" => "\x2f\x5b\x5c\x64\x5d\173\63\x7d\40\62\x5c\x2e\x30\134\56\60\x20\x28\56\x2a\51\x20\115\145\x73\163\x61\x67\x65\x2f", "\x70\x6f\163\x74\146\151\170" => "\x2f\133\x5c\x64\x5d\173\x33\x7d\x20\62\x5c\x2e\60\x5c\56\x30\x20\117\153\x3a\x20\x71\165\145\x75\145\144\x20\141\x73\x20\50\56\x2a\x29\57", "\115\x69\x63\x72\x6f\163\157\146\164\137\x45\x53\115\x54\x50" => "\x2f\x5b\60\55\x39\135\173\63\175\x20\62\134\56\133\x5c\x64\135\x5c\x2e\x30\40\50\x2e\x2a\51\x40\50\77\72\x2e\52\x29\40\x51\165\x65\165\x65\x64\x20\155\x61\151\154\x20\146\x6f\x72\x20\x64\145\x6c\x69\x76\x65\x72\x79\x2f", "\101\155\141\172\157\156\x5f\x53\105\123" => "\57\x5b\134\x64\135\173\x33\175\40\117\x6b\x20\x28\56\52\51\x2f", "\x53\x65\x6e\144\x47\x72\x69\x64" => "\57\x5b\134\144\x5d\173\63\175\x20\117\x6b\x3a\40\161\x75\145\x75\145\x64\x20\x61\163\40\x28\x2e\52\51\57", "\103\141\x6d\x70\141\151\x67\156\x4d\x6f\x6e\151\164\x6f\x72" => "\x2f\x5b\x5c\144\135\x7b\x33\175\x20\62\134\x2e\60\x5c\56\x30\x20\117\x4b\x3a\x28\x5b\x61\x2d\172\x41\55\x5a\x5c\x64\x5d\x7b\x34\x38\175\x29\57", "\110\x61\x72\x61\x6b\141" => "\57\133\134\144\135\173\x33\175\40\115\145\163\x73\x61\x67\x65\40\x51\165\145\165\x65\x64\x20\134\50\x28\56\52\51\134\x29\57", "\x5a\x6f\156\x65\115\x54\x41" => "\x2f\x5b\134\144\x5d\x7b\x33\x7d\x20\x4d\x65\x73\163\x61\x67\x65\x20\x71\165\145\x75\x65\144\40\141\x73\x20\50\56\x2a\51\x2f", "\x4d\x61\151\154\152\x65\x74" => "\x2f\133\134\144\x5d\173\63\175\40\117\113\x20\161\x75\145\165\145\x64\40\x61\x73\40\50\x2e\x2a\x29\57"); public static $xclient_allowed_attributes = array("\116\x41\x4d\x45", "\101\x44\x44\122", "\120\117\122\124", "\120\x52\117\x54\117", "\110\x45\114\x4f", "\114\x4f\107\111\x4e", "\104\x45\123\124\101\104\104\x52", "\x44\105\x53\124\x50\x4f\x52\124"); protected $last_smtp_transaction_id; protected $smtp_conn; protected $error = array("\x65\162\x72\x6f\x72" => '', "\x64\145\x74\x61\x69\x6c" => '', "\163\155\x74\160\137\x63\157\144\145" => '', "\163\x6d\164\160\137\x63\157\x64\x65\x5f\145\x78" => ''); protected $helo_rply; protected $server_caps; protected $last_reply = ''; protected function edebug($str, $level = 0) { if ($level > $this->do_debug) { return; } if ($this->Debugoutput instanceof \Psr\Log\LoggerInterface) { $this->Debugoutput->debug($str); return; } if (is_callable($this->Debugoutput) && !in_array($this->Debugoutput, array("\x65\162\x72\157\x72\137\154\157\147", "\x68\x74\155\154", "\145\x63\x68\157"))) { call_user_func($this->Debugoutput, $str, $level); return; } switch ($this->Debugoutput) { case "\x65\x72\162\x6f\162\137\154\x6f\147": error_log($str); break; case "\150\164\155\154": echo gmdate("\131\x2d\155\x2d\x64\40\x48\x3a\151\x3a\163"), "\40", htmlentities(preg_replace("\57\x5b\134\x72\134\x6e\x5d\x2b\57", '', $str), ENT_QUOTES, "\125\x54\106\55\70"), "\74\142\x72\76\xa"; break; case "\145\x63\x68\157": default: $str = preg_replace("\57\134\x72\134\x6e\174\x5c\162\57\155", "\xa", $str); echo gmdate("\x59\x2d\x6d\55\x64\x20\x48\72\151\x3a\163"), "\x9", trim(str_replace("\12", "\12\x20\x20\40\40\40\40\x20\x20\x20\40\x20\40\x20\x20\40\40\40\40\x20\x9\x20\x20\40\40\x20\40\x20\x20\40\40\40\40\40\40\40\x20\x20\x20", trim($str))), "\xa"; } } public function connect($host, $port = null, $timeout = 30, $options = array()) { $this->setError(''); if ($this->connected()) { $this->setError("\x41\154\x72\145\x61\144\x79\x20\143\157\x6e\156\x65\x63\164\x65\x64\x20\164\x6f\40\141\40\x73\145\162\166\x65\162"); return false; } if (empty($port)) { $port = self::DEFAULT_PORT; } $this->edebug("\x43\157\156\x6e\145\x63\164\151\x6f\156\72\40\x6f\x70\x65\156\151\156\147\x20\164\157\40{$host}\72{$port}\54\x20\x74\x69\x6d\145\x6f\165\164\75{$timeout}\x2c\40\x6f\x70\164\x69\157\x6e\163\x3d" . (count($options) > 0 ? var_export($options, true) : "\141\x72\x72\x61\171\x28\x29"), self::DEBUG_CONNECTION); $this->smtp_conn = $this->getSMTPConnection($host, $port, $timeout, $options); if ($this->smtp_conn === false) { return false; } $this->edebug("\x43\157\156\156\145\x63\x74\151\157\x6e\72\40\157\x70\x65\156\145\x64", self::DEBUG_CONNECTION); $this->last_reply = $this->get_lines(); $this->edebug("\x53\105\x52\126\x45\x52\x20\x2d\x3e\40\103\114\x49\x45\116\x54\x3a\40" . $this->last_reply, self::DEBUG_SERVER); $responseCode = (int) substr($this->last_reply, 0, 3); if ($responseCode === 220) { return true; } if ($responseCode === 554) { $this->quit(); } $this->edebug("\x43\x6f\x6e\156\145\x63\164\151\x6f\156\x3a\x20\x63\154\x6f\163\x69\156\x67\40\144\x75\x65\40\164\x6f\40\145\162\x72\157\x72", self::DEBUG_CONNECTION); $this->close(); return false; } protected function getSMTPConnection($host, $port = null, $timeout = 30, $options = array()) { static $streamok; if (null === $streamok) { $streamok = function_exists("\163\x74\x72\145\141\x6d\x5f\163\157\143\x6b\x65\x74\137\x63\x6c\151\145\x6e\x74"); } $errno = 0; $errstr = ''; if ($streamok) { $socket_context = stream_context_create($options); set_error_handler(array($this, "\145\162\x72\157\x72\x48\141\x6e\144\x6c\x65\162")); $connection = stream_socket_client($host . "\72" . $port, $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT, $socket_context); } else { $this->edebug("\x43\x6f\156\x6e\x65\x63\164\151\x6f\156\x3a\40\x73\x74\x72\x65\x61\155\x5f\x73\157\143\x6b\145\164\x5f\x63\154\x69\145\x6e\164\x20\156\157\164\x20\141\166\141\x69\x6c\x61\142\x6c\145\x2c\40\x66\141\154\154\x69\156\147\x20\142\141\143\x6b\x20\x74\157\40\x66\x73\157\143\153\157\160\x65\x6e", self::DEBUG_CONNECTION); set_error_handler(array($this, "\145\162\x72\x6f\x72\x48\141\156\144\x6c\145\x72")); $connection = fsockopen($host, $port, $errno, $errstr, $timeout); } restore_error_handler(); if (!is_resource($connection)) { $this->setError("\106\141\x69\x6c\x65\144\x20\164\157\40\x63\x6f\x6e\156\145\143\164\x20\x74\x6f\40\163\145\x72\x76\145\x72", '', (string) $errno, $errstr); $this->edebug("\123\115\x54\x50\40\x45\x52\122\x4f\122\72\x20" . $this->error["\145\x72\162\157\x72"] . "\72\40{$errstr}\x20\50{$errno}\51", self::DEBUG_CLIENT); return false; } if (strpos(PHP_OS, "\x57\x49\x4e") !== 0) { $max = (int) ini_get("\155\x61\170\x5f\x65\170\145\143\x75\x74\x69\157\x6e\x5f\x74\151\155\x65"); if (0 !== $max && $timeout > $max && strpos(ini_get("\x64\151\x73\141\x62\154\145\x5f\x66\x75\156\x63\164\151\157\156\x73"), "\x73\x65\x74\x5f\x74\151\x6d\x65\x5f\154\x69\155\151\164") === false) { @set_time_limit($timeout); } stream_set_timeout($connection, $timeout, 0); } return $connection; } public function startTLS() { if (!$this->sendCommand("\123\x54\101\122\x54\124\x4c\x53", "\x53\x54\x41\122\124\x54\x4c\123", 220)) { return false; } $crypto_method = STREAM_CRYPTO_METHOD_TLS_CLIENT; if (defined("\x53\x54\122\x45\101\x4d\x5f\103\x52\131\x50\124\x4f\x5f\115\x45\124\x48\x4f\104\137\x54\114\123\166\61\137\62\137\x43\x4c\x49\105\116\124")) { $crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT; $crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT; } set_error_handler(array($this, "\x65\162\x72\x6f\x72\110\141\x6e\x64\154\x65\x72")); $crypto_ok = stream_socket_enable_crypto($this->smtp_conn, true, $crypto_method); restore_error_handler(); return (bool) $crypto_ok; } public function authenticate($username, $password, $authtype = null, $OAuth = null) { if (!$this->server_caps) { $this->setError("\101\165\164\x68\145\156\164\151\143\x61\164\x69\x6f\156\40\151\x73\40\x6e\x6f\x74\40\x61\154\x6c\157\x77\x65\144\x20\142\145\x66\x6f\162\145\40\x48\x45\114\x4f\57\105\110\114\117"); return false; } if (array_key_exists("\105\x48\114\x4f", $this->server_caps)) { if (!array_key_exists("\101\125\124\x48", $this->server_caps)) { $this->setError("\x41\165\x74\150\145\156\x74\x69\x63\141\x74\x69\157\156\40\151\163\40\x6e\157\164\40\141\154\154\157\x77\145\x64\x20\141\x74\40\164\150\151\163\x20\163\164\x61\x67\x65"); return false; } $this->edebug("\101\165\x74\150\x20\x6d\145\x74\x68\157\x64\x20\x72\x65\x71\x75\145\163\x74\145\x64\72\40" . ($authtype ?: "\125\x4e\123\x50\x45\103\x49\x46\111\x45\104"), self::DEBUG_LOWLEVEL); $this->edebug("\101\x75\164\x68\40\155\x65\164\x68\157\144\163\40\x61\x76\141\x69\154\x61\x62\x6c\145\x20\157\156\40\x74\150\x65\40\163\145\x72\x76\145\162\x3a\40" . implode("\x2c", $this->server_caps["\x41\125\x54\x48"]), self::DEBUG_LOWLEVEL); if (null !== $authtype && !in_array($authtype, $this->server_caps["\x41\125\124\x48"], true)) { $this->edebug("\122\x65\161\x75\145\x73\164\145\x64\40\141\165\164\x68\40\x6d\x65\164\150\157\x64\x20\156\x6f\164\40\141\x76\141\x69\154\141\x62\x6c\x65\x3a\x20" . $authtype, self::DEBUG_LOWLEVEL); $authtype = null; } if (empty($authtype)) { foreach (array("\103\x52\101\115\x2d\115\104\65", "\114\117\107\x49\116", "\x50\x4c\x41\x49\x4e", "\x58\x4f\101\x55\x54\x48\x32") as $method) { if (in_array($method, $this->server_caps["\101\125\x54\110"], true)) { $authtype = $method; break; } } if (empty($authtype)) { $this->setError("\116\157\x20\163\x75\160\x70\x6f\x72\x74\x65\144\x20\141\165\164\x68\145\x6e\164\x69\143\141\x74\151\x6f\x6e\40\x6d\x65\x74\x68\157\x64\163\40\x66\x6f\165\x6e\144"); return false; } $this->edebug("\101\165\x74\150\x20\x6d\x65\x74\150\x6f\x64\x20\163\145\x6c\x65\143\x74\x65\144\72\40" . $authtype, self::DEBUG_LOWLEVEL); } if (!in_array($authtype, $this->server_caps["\101\125\x54\x48"], true)) { $this->setError("\x54\150\145\40\162\145\x71\165\x65\x73\164\x65\144\40\141\165\x74\x68\145\156\x74\x69\143\x61\x74\x69\157\x6e\40\155\x65\164\x68\157\144\40\42{$authtype}\x22\40\x69\163\x20\156\157\x74\x20\x73\165\x70\x70\157\x72\164\x65\x64\x20\x62\171\40\x74\150\x65\x20\163\145\162\x76\x65\x72"); return false; } } elseif (empty($authtype)) { $authtype = "\114\117\107\111\x4e"; } switch ($authtype) { case "\120\114\101\111\116": if (!$this->sendCommand("\101\125\124\x48", "\x41\x55\x54\110\x20\120\114\x41\x49\116", 334)) { return false; } if (!$this->sendCommand("\x55\163\x65\x72\x20\46\40\120\x61\x73\163\x77\x6f\x72\x64", base64_encode("\x0" . $username . "\x0" . $password), 235)) { return false; } break; case "\x4c\x4f\x47\x49\116": if (!$this->sendCommand("\101\125\x54\x48", "\101\125\124\110\40\114\117\107\111\116", 334)) { return false; } if (!$this->sendCommand("\125\163\145\162\156\141\155\145", base64_encode($username), 334)) { return false; } if (!$this->sendCommand("\120\x61\x73\163\x77\x6f\162\x64", base64_encode($password), 235)) { return false; } break; case "\x43\x52\101\115\55\115\104\x35": if (!$this->sendCommand("\101\x55\124\x48\x20\x43\x52\x41\115\x2d\x4d\104\x35", "\101\x55\x54\110\40\x43\x52\x41\115\x2d\115\104\65", 334)) { return false; } $challenge = base64_decode(substr($this->last_reply, 4)); $response = $username . "\x20" . $this->hmac($challenge, $password); return $this->sendCommand("\125\x73\145\x72\156\141\155\x65", base64_encode($response), 235); case "\130\117\101\125\x54\x48\x32": if (null === $OAuth) { return false; } $oauth = $OAuth->getOauth64(); if (!$this->sendCommand("\101\x55\x54\110", "\x41\x55\x54\110\40\x58\x4f\101\125\x54\x48\62\40" . $oauth, 235)) { return false; } break; default: $this->setError("\x41\165\x74\150\145\156\164\151\x63\141\x74\x69\x6f\156\x20\x6d\x65\164\150\x6f\x64\40\x22{$authtype}\x22\x20\x69\163\40\156\157\x74\x20\x73\x75\160\x70\157\x72\x74\145\144"); return false; } return true; } protected function hmac($data, $key) { if (function_exists("\x68\x61\163\x68\137\150\x6d\141\x63")) { return hash_hmac("\x6d\x64\x35", $data, $key); } $bytelen = 64; if (strlen($key) > $bytelen) { $key = pack("\x48\x2a", md5($key)); } $key = str_pad($key, $bytelen, chr(0)); $ipad = str_pad('', $bytelen, chr(54)); $opad = str_pad('', $bytelen, chr(92)); $k_ipad = $key ^ $ipad; $k_opad = $key ^ $opad; return md5($k_opad . pack("\x48\x2a", md5($k_ipad . $data))); } public function connected() { if (is_resource($this->smtp_conn)) { $sock_status = stream_get_meta_data($this->smtp_conn); if ($sock_status["\x65\157\x66"]) { $this->edebug("\123\115\x54\120\x20\116\x4f\x54\x49\x43\x45\72\40\x45\x4f\106\x20\143\x61\x75\147\150\x74\40\x77\x68\x69\154\145\40\143\x68\x65\x63\x6b\x69\x6e\147\40\x69\146\x20\x63\x6f\156\x6e\x65\143\x74\x65\144", self::DEBUG_CLIENT); $this->close(); return false; } return true; } return false; } public function close() { $this->server_caps = null; $this->helo_rply = null; if (is_resource($this->smtp_conn)) { fclose($this->smtp_conn); $this->smtp_conn = null; $this->edebug("\x43\x6f\x6e\x6e\x65\143\164\x69\157\x6e\72\40\143\x6c\157\x73\145\x64", self::DEBUG_CONNECTION); } } public function data($msg_data) { if (!$this->sendCommand("\x44\x41\124\x41", "\x44\x41\x54\x41", 354)) { return false; } $lines = explode("\xa", str_replace(array("\15\12", "\xd"), "\xa", $msg_data)); $field = substr($lines[0], 0, strpos($lines[0], "\72")); $in_headers = false; if (!empty($field) && strpos($field, "\40") === false) { $in_headers = true; } foreach ($lines as $line) { $lines_out = array(); if ($in_headers && $line === '') { $in_headers = false; } while (isset($line[self::MAX_LINE_LENGTH])) { $pos = strrpos(substr($line, 0, self::MAX_LINE_LENGTH), "\x20"); if (!$pos) { $pos = self::MAX_LINE_LENGTH - 1; $lines_out[] = substr($line, 0, $pos); $line = substr($line, $pos); } else { $lines_out[] = substr($line, 0, $pos); $line = substr($line, $pos + 1); } if ($in_headers) { $line = "\11" . $line; } } $lines_out[] = $line; foreach ($lines_out as $line_out) { if (!empty($line_out) && $line_out[0] === "\56") { $line_out = "\56" . $line_out; } $this->client_send($line_out . static::LE, "\104\x41\124\101"); } } $savetimelimit = $this->Timelimit; $this->Timelimit *= 2; $result = $this->sendCommand("\x44\x41\x54\101\x20\x45\116\104", "\x2e", 250); $this->recordLastTransactionID(); $this->Timelimit = $savetimelimit; return $result; } public function hello($host = '') { if ($this->sendHello("\x45\110\114\x4f", $host)) { return true; } if (substr($this->helo_rply, 0, 3) == "\64\x32\61") { return false; } return $this->sendHello("\110\x45\x4c\x4f", $host); } protected function sendHello($hello, $host) { $noerror = $this->sendCommand($hello, $hello . "\40" . $host, 250); $this->helo_rply = $this->last_reply; if ($noerror) { $this->parseHelloFields($hello); } else { $this->server_caps = null; } return $noerror; } protected function parseHelloFields($type) { $this->server_caps = array(); $lines = explode("\xa", $this->helo_rply); foreach ($lines as $n => $s) { $s = trim(substr($s, 4)); if (empty($s)) { continue; } $fields = explode("\40", $s); if (!empty($fields)) { if (!$n) { $name = $type; $fields = $fields[0]; } else { $name = array_shift($fields); switch ($name) { case "\123\111\132\x45": $fields = $fields ? $fields[0] : 0; break; case "\101\125\x54\x48": if (!is_array($fields)) { $fields = array(); } break; default: $fields = true; } } $this->server_caps[$name] = $fields; } } } public function mail($from) { $useVerp = $this->do_verp ? "\x20\x58\126\x45\x52\x50" : ''; return $this->sendCommand("\115\101\111\x4c\40\106\122\x4f\115", "\115\101\111\114\40\x46\122\x4f\x4d\x3a\x3c" . $from . "\76" . $useVerp, 250); } public function quit($close_on_error = true) { $noerror = $this->sendCommand("\121\125\111\x54", "\x51\125\111\x54", 221); $err = $this->error; if ($noerror || $close_on_error) { $this->close(); $this->error = $err; } return $noerror; } public function recipient($address, $dsn = '') { if (empty($dsn)) { $rcpt = "\x52\103\120\x54\40\124\x4f\72\x3c" . $address . "\76"; } else { $dsn = strtoupper($dsn); $notify = array(); if (strpos($dsn, "\x4e\x45\x56\105\122") !== false) { $notify[] = "\116\x45\126\x45\122"; } else { foreach (array("\123\x55\103\103\x45\123\123", "\x46\x41\111\x4c\125\122\105", "\104\x45\114\x41\x59") as $value) { if (strpos($dsn, $value) !== false) { $notify[] = $value; } } } $rcpt = "\122\103\x50\x54\x20\x54\117\72\74" . $address . "\x3e\40\x4e\x4f\124\x49\x46\x59\x3d" . implode("\54", $notify); } return $this->sendCommand("\122\x43\x50\x54\40\x54\x4f", $rcpt, array(250, 251)); } public function xclient(array $vars) { $xclient_options = ''; foreach ($vars as $key => $value) { if (in_array($key, SMTP::$xclient_allowed_attributes)) { $xclient_options .= "\40{$key}\x3d{$value}"; } } if (!$xclient_options) { return true; } return $this->sendCommand("\x58\103\x4c\x49\x45\x4e\124", "\130\103\114\111\x45\116\x54" . $xclient_options, 250); } public function reset() { return $this->sendCommand("\122\123\105\124", "\x52\123\x45\x54", 250); } protected function sendCommand($command, $commandstring, $expect) { if (!$this->connected()) { $this->setError("\103\x61\154\x6c\145\144\40{$command}\40\x77\151\x74\150\157\165\164\40\142\x65\151\156\147\40\143\x6f\156\x6e\x65\143\164\145\x64"); return false; } if (strpos($commandstring, "\xa") !== false || strpos($commandstring, "\15") !== false) { $this->setError("\103\x6f\155\155\141\x6e\144\40\47{$command}\47\40\143\x6f\x6e\164\x61\x69\x6e\x65\144\40\154\x69\x6e\145\40\142\x72\x65\141\153\x73"); return false; } $this->client_send($commandstring . static::LE, $command); $this->last_reply = $this->get_lines(); $matches = array(); if (preg_match("\x2f\136\x28\133\134\144\x5d\x7b\x33\x7d\x29\133\x20\x2d\x5d\x28\77\x3a\50\x5b\x5c\144\135\134\56\133\134\x64\135\134\x2e\133\x5c\144\135\x7b\x31\x2c\62\x7d\51\x20\x29\77\57", $this->last_reply, $matches)) { $code = (int) $matches[1]; $code_ex = count($matches) > 2 ? $matches[2] : null; $detail = preg_replace("\57{$code}\133\40\55\135" . ($code_ex ? str_replace("\x2e", "\x5c\x2e", $code_ex) . "\x20" : '') . "\57\x6d", '', $this->last_reply); } else { $code = (int) substr($this->last_reply, 0, 3); $code_ex = null; $detail = substr($this->last_reply, 4); } $this->edebug("\123\105\x52\126\x45\x52\40\x2d\76\x20\103\x4c\x49\x45\x4e\x54\x3a\x20" . $this->last_reply, self::DEBUG_SERVER); if (!in_array($code, (array) $expect, true)) { $this->setError("{$command}\x20\143\157\155\155\141\156\x64\40\x66\x61\151\154\x65\x64", $detail, $code, $code_ex); $this->edebug("\123\115\x54\120\x20\105\x52\122\x4f\x52\x3a\x20" . $this->error["\x65\162\x72\157\162"] . "\72\40" . $this->last_reply, self::DEBUG_CLIENT); return false; } if ($command !== "\x52\123\x45\x54") { $this->setError(''); } return true; } public function sendAndMail($from) { return $this->sendCommand("\123\101\115\114", "\x53\x41\115\114\40\x46\122\x4f\x4d\72{$from}", 250); } public function verify($name) { return $this->sendCommand("\126\x52\106\x59", "\x56\x52\x46\131\40{$name}", array(250, 251)); } public function noop() { return $this->sendCommand("\x4e\117\117\120", "\x4e\x4f\117\x50", 250); } public function turn() { $this->setError("\x54\150\145\40\x53\x4d\x54\120\x20\x54\x55\x52\x4e\x20\143\157\x6d\155\141\x6e\x64\x20\x69\x73\40\156\157\x74\40\x69\x6d\x70\154\145\x6d\x65\x6e\x74\145\144"); $this->edebug("\x53\x4d\x54\120\40\116\117\x54\x49\103\105\72\x20" . $this->error["\x65\x72\162\157\x72"], self::DEBUG_CLIENT); return false; } public function client_send($data, $command = '') { if (self::DEBUG_LOWLEVEL > $this->do_debug && in_array($command, array("\125\163\145\162\40\x26\x20\x50\141\x73\x73\x77\157\162\144", "\x55\163\145\162\156\141\x6d\145", "\x50\x61\x73\163\x77\157\x72\x64"), true)) { $this->edebug("\103\x4c\111\x45\x4e\124\x20\x2d\x3e\x20\x53\x45\122\126\105\x52\72\x20\133\143\162\x65\144\x65\x6e\164\151\141\x6c\x73\40\x68\151\144\144\x65\x6e\x5d", self::DEBUG_CLIENT); } else { $this->edebug("\103\114\x49\105\116\x54\x20\55\76\x20\x53\x45\122\126\105\x52\x3a\40" . $data, self::DEBUG_CLIENT); } set_error_handler(array($this, "\x65\x72\162\x6f\x72\110\141\156\x64\x6c\145\162")); $result = fwrite($this->smtp_conn, $data); restore_error_handler(); return $result; } public function getError() { return $this->error; } public function getServerExtList() { return $this->server_caps; } public function getServerExt($name) { if (!$this->server_caps) { $this->setError("\x4e\157\40\110\105\114\117\x2f\x45\x48\114\x4f\x20\167\x61\163\x20\163\145\156\164"); return null; } if (!array_key_exists($name, $this->server_caps)) { if ("\x48\105\114\x4f" === $name) { return $this->server_caps["\105\x48\114\117"]; } if ("\x45\x48\x4c\x4f" === $name || array_key_exists("\105\110\x4c\117", $this->server_caps)) { return false; } $this->setError("\110\x45\x4c\117\x20\x68\x61\x6e\144\x73\x68\141\x6b\x65\x20\x77\x61\163\x20\x75\163\x65\144\73\40\x4e\157\x20\151\x6e\x66\157\162\155\x61\164\x69\x6f\156\x20\141\x62\x6f\165\x74\x20\163\x65\162\166\145\x72\40\145\170\164\145\156\163\151\157\x6e\x73\x20\x61\166\x61\x69\x6c\x61\142\x6c\x65"); return null; } return $this->server_caps[$name]; } public function getLastReply() { return $this->last_reply; } protected function get_lines() { if (!is_resource($this->smtp_conn)) { return ''; } $data = ''; $endtime = 0; stream_set_timeout($this->smtp_conn, $this->Timeout); if ($this->Timelimit > 0) { $endtime = time() + $this->Timelimit; } $selR = array($this->smtp_conn); $selW = null; while (is_resource($this->smtp_conn) && !feof($this->smtp_conn)) { set_error_handler(array($this, "\x65\162\162\157\x72\x48\x61\x6e\144\154\x65\162")); $n = stream_select($selR, $selW, $selW, $this->Timelimit); restore_error_handler(); if ($n === false) { $message = $this->getError()["\x64\145\x74\141\151\154"]; $this->edebug("\123\x4d\124\120\40\x2d\x3e\40\147\x65\164\137\154\x69\x6e\145\x73\50\x29\x3a\40\x73\145\x6c\x65\x63\164\x20\146\141\151\154\x65\x64\40\x28" . $message . "\51", self::DEBUG_LOWLEVEL); if (stripos($message, "\151\x6e\x74\145\x72\x72\x75\160\x74\x65\144\40\x73\x79\163\x74\x65\155\40\x63\x61\154\154") !== false) { $this->edebug("\123\x4d\x54\120\x20\55\x3e\40\147\x65\164\x5f\154\x69\156\x65\x73\50\51\x3a\40\x72\x65\164\162\x79\151\156\147\x20\163\x74\x72\x65\x61\x6d\137\163\x65\x6c\x65\143\164", self::DEBUG_LOWLEVEL); $this->setError(''); continue; } break; } if (!$n) { $this->edebug("\x53\115\x54\120\x20\55\x3e\x20\147\145\x74\x5f\154\151\156\x65\x73\x28\51\x3a\x20\x73\x65\x6c\145\x63\164\x20\164\x69\155\x65\x64\55\x6f\x75\x74\40\x69\156\x20\50" . $this->Timelimit . "\x20\x73\x65\143\51", self::DEBUG_LOWLEVEL); break; } $str = @fgets($this->smtp_conn, self::MAX_REPLY_LENGTH); $this->edebug("\123\115\124\x50\40\111\x4e\x42\117\125\x4e\x44\x3a\x20\42" . trim($str) . "\x22", self::DEBUG_LOWLEVEL); $data .= $str; if (!isset($str[3]) || $str[3] === "\40" || $str[3] === "\15" || $str[3] === "\xa") { break; } $info = stream_get_meta_data($this->smtp_conn); if ($info["\x74\151\155\145\x64\137\157\165\x74"]) { $this->edebug("\123\115\124\120\x20\x2d\x3e\x20\x67\x65\164\x5f\154\x69\156\145\163\50\51\72\40\163\x74\162\x65\141\x6d\40\x74\151\x6d\x65\144\55\157\x75\x74\x20\x28" . $this->Timeout . "\x20\x73\145\x63\51", self::DEBUG_LOWLEVEL); break; } if ($endtime && time() > $endtime) { $this->edebug("\x53\x4d\x54\120\x20\x2d\76\x20\147\x65\164\x5f\154\151\x6e\x65\163\50\51\72\x20\x74\x69\155\145\154\151\x6d\x69\164\x20\162\145\141\143\x68\x65\x64\40\x28" . $this->Timelimit . "\x20\x73\x65\143\x29", self::DEBUG_LOWLEVEL); break; } } return $data; } public function setVerp($enabled = false) { $this->do_verp = $enabled; } public function getVerp() { return $this->do_verp; } protected function setError($message, $detail = '', $smtp_code = '', $smtp_code_ex = '') { $this->error = array("\145\162\x72\157\162" => $message, "\x64\145\164\x61\151\x6c" => $detail, "\x73\x6d\x74\x70\137\x63\x6f\144\145" => $smtp_code, "\163\155\x74\x70\x5f\143\157\144\145\x5f\x65\x78" => $smtp_code_ex); } public function setDebugOutput($method = "\x65\143\x68\x6f") { $this->Debugoutput = $method; } public function getDebugOutput() { return $this->Debugoutput; } public function setDebugLevel($level = 0) { $this->do_debug = $level; } public function getDebugLevel() { return $this->do_debug; } public function setTimeout($timeout = 0) { $this->Timeout = $timeout; } public function getTimeout() { return $this->Timeout; } protected function errorHandler($errno, $errmsg, $errfile = '', $errline = 0) { $notice = "\103\x6f\x6e\x6e\x65\143\164\x69\x6f\x6e\40\146\141\151\x6c\145\x64\x2e"; $this->setError($notice, $errmsg, (string) $errno); $this->edebug("{$notice}\40\105\162\162\x6f\x72\x20\43{$errno}\72\40{$errmsg}\40\x5b{$errfile}\40\154\151\156\x65\x20{$errline}\x5d", self::DEBUG_CONNECTION); } 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 = array(); if (preg_match($smtp_transaction_id_pattern, $reply, $matches)) { $this->last_smtp_transaction_id = trim($matches[1]); break; } } } return $this->last_smtp_transaction_id; } public function getLastTransactionID() { return $this->last_smtp_transaction_id; } }

Function Calls

None

Variables

None

Stats

MD5 a8d909f54d98ec7e6435da3e64d2229f
Eval Count 0
Decode Time 117 ms