diff --git a/app/sprinkles/core/src/Mail/Mailer.php b/app/sprinkles/core/src/Mail/Mailer.php index 1f957b729..2e2efa4d6 100644 --- a/app/sprinkles/core/src/Mail/Mailer.php +++ b/app/sprinkles/core/src/Mail/Mailer.php @@ -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'];