SMTP.php (mrbs-1.9.4) | : | SMTP.php (mrbs-1.10.0) | ||
---|---|---|---|---|
skipping to change at line 38 | skipping to change at line 38 | |||
* @author Chris Ryan | * @author Chris Ryan | |||
* @author Marcus Bointon <phpmailer@synchromedia.co.uk> | * @author Marcus Bointon <phpmailer@synchromedia.co.uk> | |||
*/ | */ | |||
class SMTP | class SMTP | |||
{ | { | |||
/** | /** | |||
* The PHPMailer SMTP version number. | * The PHPMailer SMTP version number. | |||
* | * | |||
* @var string | * @var string | |||
*/ | */ | |||
const VERSION = '6.4.1'; | const VERSION = '6.5.3'; | |||
/** | /** | |||
* SMTP line break constant. | * SMTP line break constant. | |||
* | * | |||
* @var string | * @var string | |||
*/ | */ | |||
const LE = "\r\n"; | const LE = "\r\n"; | |||
/** | /** | |||
* The SMTP port to use if one is not specified. | * The SMTP port to use if one is not specified. | |||
skipping to change at line 189 | skipping to change at line 189 | |||
* @var string[] | * @var string[] | |||
*/ | */ | |||
protected $smtp_transaction_id_patterns = [ | protected $smtp_transaction_id_patterns = [ | |||
'exim' => '/[\d]{3} OK id=(.*)/', | 'exim' => '/[\d]{3} OK id=(.*)/', | |||
'sendmail' => '/[\d]{3} 2.0.0 (.*) Message/', | 'sendmail' => '/[\d]{3} 2.0.0 (.*) Message/', | |||
'postfix' => '/[\d]{3} 2.0.0 Ok: queued as (.*)/', | 'postfix' => '/[\d]{3} 2.0.0 Ok: queued as (.*)/', | |||
'Microsoft_ESMTP' => '/[0-9]{3} 2.[\d].0 (.*)@(?:.*) Queued mail for del ivery/', | 'Microsoft_ESMTP' => '/[0-9]{3} 2.[\d].0 (.*)@(?:.*) Queued mail for del ivery/', | |||
'Amazon_SES' => '/[\d]{3} Ok (.*)/', | 'Amazon_SES' => '/[\d]{3} Ok (.*)/', | |||
'SendGrid' => '/[\d]{3} Ok: queued as (.*)/', | 'SendGrid' => '/[\d]{3} Ok: queued as (.*)/', | |||
'CampaignMonitor' => '/[\d]{3} 2.0.0 OK:([a-zA-Z\d]{48})/', | 'CampaignMonitor' => '/[\d]{3} 2.0.0 OK:([a-zA-Z\d]{48})/', | |||
'Haraka' => '/[\d]{3} Message Queued \((.*)\)/', | ||||
]; | ]; | |||
/** | /** | |||
* The last transaction ID issued in response to a DATA command, | * The last transaction ID issued in response to a DATA command, | |||
* if one was detected. | * if one was detected. | |||
* | * | |||
* @var string|bool|null | * @var string|bool|null | |||
*/ | */ | |||
protected $last_smtp_transaction_id; | protected $last_smtp_transaction_id; | |||
skipping to change at line 394 | skipping to change at line 395 | |||
$socket_context = stream_context_create($options); | $socket_context = stream_context_create($options); | |||
set_error_handler([$this, 'errorHandler']); | set_error_handler([$this, 'errorHandler']); | |||
$connection = stream_socket_client( | $connection = stream_socket_client( | |||
$host . ':' . $port, | $host . ':' . $port, | |||
$errno, | $errno, | |||
$errstr, | $errstr, | |||
$timeout, | $timeout, | |||
STREAM_CLIENT_CONNECT, | STREAM_CLIENT_CONNECT, | |||
$socket_context | $socket_context | |||
); | ); | |||
restore_error_handler(); | ||||
} else { | } else { | |||
//Fall back to fsockopen which should work in more places, but is mi ssing some features | //Fall back to fsockopen which should work in more places, but is mi ssing some features | |||
$this->edebug( | $this->edebug( | |||
'Connection: stream_socket_client not available, falling back to fsockopen', | 'Connection: stream_socket_client not available, falling back to fsockopen', | |||
self::DEBUG_CONNECTION | self::DEBUG_CONNECTION | |||
); | ); | |||
set_error_handler([$this, 'errorHandler']); | set_error_handler([$this, 'errorHandler']); | |||
$connection = fsockopen( | $connection = fsockopen( | |||
$host, | $host, | |||
$port, | $port, | |||
$errno, | $errno, | |||
$errstr, | $errstr, | |||
$timeout | $timeout | |||
); | ); | |||
restore_error_handler(); | ||||
} | } | |||
restore_error_handler(); | ||||
//Verify we connected properly | //Verify we connected properly | |||
if (!is_resource($connection)) { | if (!is_resource($connection)) { | |||
$this->setError( | $this->setError( | |||
'Failed to connect to server', | 'Failed to connect to server', | |||
'', | '', | |||
(string) $errno, | (string) $errno, | |||
$errstr | $errstr | |||
); | ); | |||
$this->edebug( | $this->edebug( | |||
skipping to change at line 698 | skipping to change at line 698 | |||
//Close the connection and cleanup | //Close the connection and cleanup | |||
fclose($this->smtp_conn); | fclose($this->smtp_conn); | |||
$this->smtp_conn = null; //Makes for cleaner serialization | $this->smtp_conn = null; //Makes for cleaner serialization | |||
$this->edebug('Connection: closed', self::DEBUG_CONNECTION); | $this->edebug('Connection: closed', self::DEBUG_CONNECTION); | |||
} | } | |||
} | } | |||
/** | /** | |||
* Send an SMTP DATA command. | * Send an SMTP DATA command. | |||
* Issues a data command and sends the msg_data to the server, | * Issues a data command and sends the msg_data to the server, | |||
* finializing the mail transaction. $msg_data is the message | * finalizing the mail transaction. $msg_data is the message | |||
* that is to be send with the headers. Each header needs to be | * that is to be send with the headers. Each header needs to be | |||
* on a single line followed by a <CRLF> with the message headers | * on a single line followed by a <CRLF> with the message headers | |||
* and the message body being separated by an additional <CRLF>. | * and the message body being separated by an additional <CRLF>. | |||
* Implements RFC 821: DATA <CRLF>. | * Implements RFC 821: DATA <CRLF>. | |||
* | * | |||
* @param string $msg_data Message data to send | * @param string $msg_data Message data to send | |||
* | * | |||
* @return bool | * @return bool | |||
*/ | */ | |||
public function data($msg_data) | public function data($msg_data) | |||
skipping to change at line 1172 | skipping to change at line 1172 | |||
* | * | |||
* @param string $name Name of SMTP extension or 'HELO'|'EHLO' | * @param string $name Name of SMTP extension or 'HELO'|'EHLO' | |||
* | * | |||
* @return string|bool|null | * @return string|bool|null | |||
*/ | */ | |||
public function getServerExt($name) | public function getServerExt($name) | |||
{ | { | |||
if (!$this->server_caps) { | if (!$this->server_caps) { | |||
$this->setError('No HELO/EHLO was sent'); | $this->setError('No HELO/EHLO was sent'); | |||
return; | return null; | |||
} | } | |||
if (!array_key_exists($name, $this->server_caps)) { | if (!array_key_exists($name, $this->server_caps)) { | |||
if ('HELO' === $name) { | if ('HELO' === $name) { | |||
return $this->server_caps['EHLO']; | return $this->server_caps['EHLO']; | |||
} | } | |||
if ('EHLO' === $name || array_key_exists('EHLO', $this->server_caps) ) { | if ('EHLO' === $name || array_key_exists('EHLO', $this->server_caps) ) { | |||
return false; | return false; | |||
} | } | |||
$this->setError('HELO handshake was used; No information about serve r extensions available'); | $this->setError('HELO handshake was used; No information about serve r extensions available'); | |||
return; | return null; | |||
} | } | |||
return $this->server_caps[$name]; | return $this->server_caps[$name]; | |||
} | } | |||
/** | /** | |||
* Get the last reply from the server. | * Get the last reply from the server. | |||
* | * | |||
* @return string | * @return string | |||
*/ | */ | |||
End of changes. 8 change blocks. | ||||
6 lines changed or deleted | 6 lines changed or added |