diff --git a/PHPCI/Helper/MailerFactory.php b/PHPCI/Helper/MailerFactory.php index b0ec4860..4eb57c13 100644 --- a/PHPCI/Helper/MailerFactory.php +++ b/PHPCI/Helper/MailerFactory.php @@ -28,11 +28,19 @@ class MailerFactory */ public function getSwiftMailerFromConfig() { + $encryptionType = $this->getMailConfig('smtp_encryption'); + + // Workaround issue where smtp_encryption could == 1 in the past by + // checking it is a valid transport + if ($encryptionType && !in_array($encryptionType, stream_get_transports())) { + $encryptionType = null; + } + /** @var \Swift_SmtpTransport $transport */ $transport = \Swift_SmtpTransport::newInstance( $this->getMailConfig('smtp_address'), $this->getMailConfig('smtp_port'), - $this->getMailConfig('smtp_encryption') + $encryptionType ); $transport->setUsername($this->getMailConfig('smtp_username')); $transport->setPassword($this->getMailConfig('smtp_password'));