Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: PHPMailer/PHPMailer
...
head fork: NanoCaiordo/PHPMailer
Checking mergeability… Don't worry, you can still create the pull request.
  • 1 commit
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Showing with 12 additions and 17 deletions.
  1. +12 −17 class.phpmailer.php
View
29 class.phpmailer.php
@@ -1074,18 +1074,15 @@ public function SmtpConnect() {
$this->smtp->Debugoutput = $this->Debugoutput;
$this->smtp->do_verp = $this->do_verp;
$hosts = explode(';', $this->Host);
- $index = 0;
- $connection = $this->smtp->Connected();
// Retry while there is no connection
- try {
- while($index < count($hosts) && !$connection) {
- $hostinfo = array();
- if (preg_match('/^(.+):([0-9]+)$/', $hosts[$index], $hostinfo)) {
+ for ($i=0,$c=count($hosts); $i<$c; ++$i) {
+ try {
+ if (preg_match('/^(.+):([0-9]+)$/', $hosts[$i], $hostinfo)) {
$host = $hostinfo[1];
$port = $hostinfo[2];
} else {
- $host = $hosts[$index];
+ $host = $hosts[$i];
$port = $this->Port;
}
@@ -1106,25 +1103,23 @@ public function SmtpConnect() {
$this->smtp->Hello($hello);
}
- $connection = true;
if ($this->SMTPAuth) {
if (!$this->smtp->Authenticate($this->Username, $this->Password, $this->AuthType, $this->Realm, $this->Workstation)) {
throw new phpmailerException($this->Lang('authenticate'));
}
}
- }
- $index++;
- if (!$connection) {
+ } else {
throw new phpmailerException($this->Lang('connect_host'));
}
- }
- } catch (phpmailerException $e) {
- $this->smtp->Reset();
- if ($this->exceptions) {
- throw $e;
+ return true;
+ } catch (phpmailerException $e) {
+ $this->smtp->Reset();
+ if ($i==$c-1 && $this->exceptions) {
+ throw $e;
+ }
}
}
- return true;
+ return false;
}
/**

No commit comments for this range

Something went wrong with that request. Please try again.