Skip to content

Commit

Permalink
Improve check for SMTP close on destruct, fixes PHPMailer#658
Browse files Browse the repository at this point in the history
  • Loading branch information
sinteur committed Mar 18, 2016
1 parent 99bf646 commit 33c33b5
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions class.phpmailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -645,9 +645,7 @@ public function __construct($exceptions = false)
public function __destruct()
{
//Close any open SMTP connection nicely
if ($this->Mailer == 'smtp') {
$this->smtpClose();
}
$this->smtpClose();
}

/**
Expand Down Expand Up @@ -1634,7 +1632,7 @@ public function smtpConnect($options = array())
*/
public function smtpClose()
{
if ($this->smtp !== null) {
if (is_a($this->smtp, 'SMTP')) {
if ($this->smtp->connected()) {
$this->smtp->quit();
$this->smtp->close();
Expand Down

0 comments on commit 33c33b5

Please sign in to comment.