Alter the way that SMTP host lists are parsed, fixes #112
This commit is contained in:
parent
c92b5bc4e1
commit
accd948dad
|
|
@ -5,6 +5,7 @@
|
|||
* Add connection events and new level 3 to debug output options
|
||||
* Chinese language update (Thanks to @binaryoung)
|
||||
* Allow custom Mailer types (thanks to @michield)
|
||||
* Cope with spaces around SMTP host specs
|
||||
|
||||
## Version 5.2.7 (September 12th 2013)
|
||||
* Add Ukranian translation from @Krezalis
|
||||
|
|
|
|||
|
|
@ -1248,17 +1248,10 @@ class PHPMailer
|
|||
$lastexception = null;
|
||||
|
||||
foreach ($hosts as $hostentry) {
|
||||
$hostinfo = array();
|
||||
$host = $hostentry;
|
||||
$host = trim($hostentry);
|
||||
$port = $this->Port;
|
||||
if (preg_match(
|
||||
'/^(.+):([0-9]+)$/',
|
||||
$hostentry,
|
||||
$hostinfo
|
||||
)
|
||||
) { //If $hostentry contains 'address:port', override default
|
||||
$host = $hostinfo[1];
|
||||
$port = $hostinfo[2];
|
||||
if (strpos($host, ':') !== false) {
|
||||
list($host, $port) = explode(':', $host);
|
||||
}
|
||||
if ($this->smtp->connect(($ssl ? 'ssl://' : '') . $host, $port, $this->Timeout, $options)) {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -1039,6 +1039,9 @@ EOT;
|
|||
$this->Mail->Host = "localhost:12345;10.10.10.10:54321;" . $_REQUEST['mail_host'];
|
||||
$this->assertTrue($this->Mail->smtpConnect(), 'SMTP multi-connect failed');
|
||||
$this->Mail->smtpClose();
|
||||
$this->Mail->Host = " localhost:12345 ; " . $_REQUEST['mail_host'] . ' ';
|
||||
$this->assertTrue($this->Mail->smtpConnect(), 'SMTP hosts with stray spaces failed');
|
||||
$this->Mail->smtpClose();
|
||||
$this->Mail->Host = $_REQUEST['mail_host'];
|
||||
//Need to pick a harmless option so as not cause problems of its own! socket:bind doesn't work with Travis-CI
|
||||
$this->assertTrue(
|
||||
|
|
|
|||
Loading…
Reference in New Issue