Skip to content

Commit

Permalink
Resolves Issue userfrosting#986 - Turn off opportunistic TLS when dis…
Browse files Browse the repository at this point in the history
…abled.

This ensures that when you have disabled 'secure' in your mail
config no TLS attempts are ... attempted.

This is because PHPMailer requires a valid Certificate, which
may not always be available.  See:
   https://github.com/PHPMailer/PHPMailer/blob/master/src/PHPMailer.php#L282

Signed-Off-By: Rob Thomas <xrobau@gmail.com>
  • Loading branch information
xrobau committed May 30, 2019
1 parent 07d9035 commit a071817
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/sprinkles/core/src/Mail/Mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ public function __construct($logger, $config = [])
$this->phpMailer->Username = $config['username'];
$this->phpMailer->Password = $config['password'];
$this->phpMailer->SMTPDebug = $config['smtp_debug'];
// Disable opportunistic encryption if secure is unset. This is
// required if you have an incorrect or invalid SSL Certificate on
// your SMTP host, but the server offers STARTTLS.
if (!$config['secure']) {
$this->phpMailer->SMTPAutoTLS = false;
}

if (isset($config['smtp_options'])) {
$this->phpMailer->SMTPOptions = $config['smtp_options'];
Expand Down

0 comments on commit a071817

Please sign in to comment.