Skip to content

Commit

Permalink
Merge branch 'hotfix/1.4.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Toflar committed Nov 6, 2017
2 parents dedf902 + 6cc67ce commit e5a1db6
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions library/NotificationCenter/Gateway/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,25 @@ public function send(Message $objMessage, array $arrTokens, $strLanguage = '')
}

// Override SMTP settings if desired
$this->overrideSMTPSettings();
$objEmail = new \Email();
$this->resetSMTPSettings();
if (version_compare(VERSION, '4.4', '>=') && $this->objModel->email_overrideSmtp) {
$transport = \Swift_SmtpTransport::newInstance($this->objModel->email_smtpHost, $this->objModel->email_smtpPort);

// Encryption
if ($this->objModel->email_smtpEnc === 'ssl' || $this->objModel->email_smtpEnc === 'tls') {
$transport->setEncryption($this->objModel->email_smtpEnc);
}

// Authentication
if ($this->objModel->email_smtpUser) {
$transport->setUsername($this->objModel->email_smtpUser)->setPassword($this->objModel->email_smtpPass);
}

$objEmail = new \Email(new \Swift_Mailer($transport));
} else {
$this->overrideSMTPSettings();
$objEmail = new \Email();
$this->resetSMTPSettings();
}

// Set priority
$objEmail->priority = $objDraft->getPriority();
Expand Down

0 comments on commit e5a1db6

Please sign in to comment.