Skip to content

Commit

Permalink
Bug #20513: Mail_smtp::send() doesn't close socket for smtp connectio…
Browse files Browse the repository at this point in the history
…n [patch by e79ene]
  • Loading branch information
ashnazg committed Apr 11, 2017
1 parent 323726a commit 8291878
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions Mail/smtp.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,18 @@ public function __destruct()
* failure.
*/
public function send($recipients, $headers, $body)
{
$result = $this->send_or_fail($recipients, $headers, $body);

/* If persistent connections are disabled, destroy our SMTP object. */
if ($this->persist === false) {
$this->disconnect();
}

return $result;
}

protected function send_or_fail($recipients, $headers, $body)
{
/* If we don't already have an SMTP object, create one. */
$result = $this->getSMTPObject();
Expand Down Expand Up @@ -332,11 +344,6 @@ public function send($recipients, $headers, $body)
return PEAR::raiseError($error, PEAR_MAIL_SMTP_ERROR_DATA);
}

/* If persistent connections are disabled, destroy our SMTP object. */
if ($this->persist === false) {
$this->disconnect();
}

return true;
}

Expand Down

0 comments on commit 8291878

Please sign in to comment.