Name constants consistently
Remove unnecessary POP3 properties Merge branch 'master' into 6.0 # Conflicts: # src/PHPMailer.php # src/POP3.php # src/SMTP.php
This commit is contained in:
parent
e52f61a070
commit
9727777f27
20
changelog.md
20
changelog.md
|
|
@ -4,7 +4,7 @@
|
|||
This is a major update that breaks backwards compatibility.
|
||||
|
||||
* **Requires PHP 5.5 or later**
|
||||
* Uses the `PHPMailer\PHPMailer` namespace
|
||||
* **Uses the `PHPMailer\PHPMailer` namespace**
|
||||
* File structure simplified and PSR-4 compatible, classes live in the `src/` folder
|
||||
* The custom autoloader has been removed: [**use composer**](https://getcomposer.org)!
|
||||
* Classes & Exceptions renamed to make use of the namespace
|
||||
|
|
@ -17,15 +17,17 @@ This is a major update that breaks backwards compatibility.
|
|||
* Extensive reworking of XOAUTH2, adding support for Google, Yahoo and Microsoft providers, thanks to @sherryl4george
|
||||
* Major cleanup of docs and examples
|
||||
* All elements previously marked as deprecated have been removed:
|
||||
* `PHPMailer->Version`
|
||||
* `PHPMailer->Version` (replaced with VERSION constant)
|
||||
* `PHPMailer->ReturnPath`
|
||||
* `PHPMailer->PluginDir`
|
||||
* `PHPMailer->encodeQPphp()`
|
||||
* `SMTP->CRLF`
|
||||
* `SMTP->Version`
|
||||
* `SMTP->SMTP_PORT`
|
||||
* `POP3->CRLF`
|
||||
* `POP3->Version`
|
||||
* `SMTP->CRLF` (replaced with LE constant)
|
||||
* `SMTP->Version` (replaced with VERSION constant)
|
||||
* `SMTP->SMTP_PORT` (replaced with DEFAULT_PORT constant)
|
||||
* `POP3->CRLF` (replaced with LE constant)
|
||||
* `POP3->Version` (replaced with VERSION constant)
|
||||
* `POP3->POP3_PORT` (replaced with DEFAULT_PORT constant)
|
||||
* `POP3->POP3_TIMEOUT` (replaced with DEFAULT_TIMEOUT constant)
|
||||
* NTLM authentication has been removed - it never worked anyway!
|
||||
* `PHPMailer->Workstation`
|
||||
* `PHPMailer->Realm`
|
||||
|
|
@ -38,8 +40,8 @@ This is a major update that breaks backwards compatibility.
|
|||
* Reorder automatic AUTH mechanism selector to try most secure method first
|
||||
* `Extras` classes have been removed - use alternative packages from [packagist.org](https://packagist.org) instead
|
||||
* Better handling of automatic transfer encoding switch in the presence of long lines
|
||||
* Simplification of address validation - now uses PHP's filter_var by default, retains advanced options
|
||||
* `Debugoutput` now accepts a PSR-3 logger instance
|
||||
* Simplification of address validation - now uses PHP's `FILTER_VALIDATE_EMAIL` pattern by default, retains advanced options
|
||||
* `Debugoutput` can accept a PSR-3 logger instance
|
||||
* To reduce code footprint, the examples folder is no longer included in composer deployments or github zip files
|
||||
|
||||
## Version 5.2.17 (December 9th 2016)
|
||||
|
|
|
|||
12
src/POP3.php
12
src/POP3.php
|
|
@ -46,21 +46,21 @@ class POP3
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
public $Version = '6.0.0';
|
||||
const VERSION = '6.0.0';
|
||||
|
||||
/**
|
||||
* Default POP3 port number.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
public $POP3_PORT = 110;
|
||||
const DEFAULT_PORT = 110;
|
||||
|
||||
/**
|
||||
* Default timeout in seconds.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
public $POP3_TIMEOUT = 30;
|
||||
const DEFAULT_TIMEOUT = 30;
|
||||
|
||||
/**
|
||||
* Debug display level.
|
||||
|
|
@ -174,13 +174,13 @@ class POP3
|
|||
$this->host = $host;
|
||||
// If no port value provided, use default
|
||||
if (false === $port) {
|
||||
$this->port = $this->POP3_PORT;
|
||||
$this->port = static::DEFAULT_PORT;
|
||||
} else {
|
||||
$this->port = (integer)$port;
|
||||
}
|
||||
// If no timeout value provided, use default
|
||||
if (false === $timeout) {
|
||||
$this->tval = $this->POP3_TIMEOUT;
|
||||
$this->tval = static::DEFAULT_TIMEOUT;
|
||||
} else {
|
||||
$this->tval = (integer)$timeout;
|
||||
}
|
||||
|
|
@ -224,7 +224,7 @@ class POP3
|
|||
set_error_handler([$this, 'catchWarning']);
|
||||
|
||||
if (false === $port) {
|
||||
$port = $this->POP3_PORT;
|
||||
$port = static::DEFAULT_PORT;
|
||||
}
|
||||
|
||||
// connect to the POP3 server
|
||||
|
|
|
|||
62
src/SMTP.php
62
src/SMTP.php
|
|
@ -49,7 +49,7 @@ class SMTP
|
|||
*
|
||||
* @var integer
|
||||
*/
|
||||
const DEFAULT_SMTP_PORT = 25;
|
||||
const DEFAULT_PORT = 25;
|
||||
|
||||
/**
|
||||
* The maximum line length allowed by RFC 2822 section 2.1.1
|
||||
|
|
@ -143,16 +143,16 @@ class SMTP
|
|||
*/
|
||||
public $Timelimit = 300;
|
||||
|
||||
/**
|
||||
* @var array patterns to extract smtp transaction id from smtp reply
|
||||
* Only first capture group will be use, use non-capturing group to deal with it
|
||||
* Extend this class to override this property to fulfil your needs.
|
||||
*/
|
||||
protected $smtp_transaction_id_patterns = array(
|
||||
'exim' => '/[0-9]{3} OK id=(.*)/',
|
||||
'sendmail' => '/[0-9]{3} 2.0.0 (.*) Message/',
|
||||
'postfix' => '/[0-9]{3} 2.0.0 Ok: queued as (.*)/'
|
||||
);
|
||||
/**
|
||||
* @var array patterns to extract smtp transaction id from smtp reply
|
||||
* Only first capture group will be use, use non-capturing group to deal with it
|
||||
* Extend this class to override this property to fulfil your needs.
|
||||
*/
|
||||
protected $smtp_transaction_id_patterns = [
|
||||
'exim' => '/[0-9]{3} OK id=(.*)/',
|
||||
'sendmail' => '/[0-9]{3} 2.0.0 (.*) Message/',
|
||||
'postfix' => '/[0-9]{3} 2.0.0 Ok: queued as (.*)/'
|
||||
];
|
||||
|
||||
/**
|
||||
* The socket for the server connection.
|
||||
|
|
@ -277,7 +277,7 @@ class SMTP
|
|||
return false;
|
||||
}
|
||||
if (empty($port)) {
|
||||
$port = self::DEFAULT_SMTP_PORT;
|
||||
$port = self::DEFAULT_PORT;
|
||||
}
|
||||
// Connect to the SMTP server
|
||||
$this->edebug(
|
||||
|
|
@ -1200,27 +1200,27 @@ class SMTP
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will return the ID of the last smtp transaction based on a list of patterns provided
|
||||
* in SMTP::$smtp_transaction_id_patterns.
|
||||
* If no reply has been received yet, it will return null.
|
||||
* If no pattern has been matched, it will return false.
|
||||
* @return bool|null|string
|
||||
*/
|
||||
public function getLastTransactionID()
|
||||
{
|
||||
$reply = $this->getLastReply();
|
||||
/**
|
||||
* Will return the ID of the last smtp transaction based on a list of patterns provided
|
||||
* in SMTP::$smtp_transaction_id_patterns.
|
||||
* If no reply has been received yet, it will return null.
|
||||
* If no pattern has been matched, it will return false.
|
||||
* @return bool|null|string
|
||||
*/
|
||||
public function getLastTransactionID()
|
||||
{
|
||||
$reply = $this->getLastReply();
|
||||
|
||||
if (empty($reply)) {
|
||||
return null;
|
||||
}
|
||||
if (empty($reply)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
foreach($this->smtp_transaction_id_patterns as $smtp_transaction_id_pattern) {
|
||||
if(preg_match($smtp_transaction_id_pattern, $reply, $matches)) {
|
||||
return $matches[1];
|
||||
}
|
||||
}
|
||||
foreach ($this->smtp_transaction_id_patterns as $smtp_transaction_id_pattern) {
|
||||
if (preg_match($smtp_transaction_id_pattern, $reply, $matches)) {
|
||||
return $matches[1];
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue