Adding check for a valid encryption context to MailerFactory.
This commit is contained in:
parent
980cc147ac
commit
3172b0f1d8
|
@ -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'));
|
||||
|
|
Loading…
Reference in a new issue