Add pear modules, mail and net_smtp via composer (#93)

Add pear modules, mail and net_smtp via composer, remove php 5.6 build due to phpunit 6
This commit is contained in:
Thilina Hasantha
2018-01-08 23:13:43 +01:00
committed by GitHub
parent 359e3f8382
commit e7792e7d79
2349 changed files with 117270 additions and 83170 deletions

View File

@@ -30,7 +30,6 @@ class PHPMailer extends EmailSender
) {
try {
if ($fromName) {
$fromEmail = $fromName." <".$fromEmail.">";
}

View File

@@ -6,59 +6,58 @@ use Utils\LogManager;
class SwiftMailer extends EmailSender
{
public function __construct($settings)
{
parent::__construct($settings);
}
public function __construct($settings)
{
parent::__construct($settings);
}
protected function sendMail(
$subject,
$body,
$toEmail,
$fromEmail,
$replyToEmail = null,
$ccList = array(),
$bccList = array(),
$fromName = null
) {
protected function sendMail(
$subject,
$body,
$toEmail,
$fromEmail,
$replyToEmail = null,
$ccList = array(),
$bccList = array(),
$fromName = null
) {
try {
if (empty($replyToEmail)) {
$replyToEmail = $fromEmail;
}
try {
if (empty($replyToEmail)) {
$replyToEmail = $fromEmail;
}
LogManager::getInstance()->info("Sending email to: " . $toEmail . "/ from: " . $fromEmail);
LogManager::getInstance()->info("Sending email to: " . $toEmail . "/ from: " . $fromEmail);
$host = $this->settings->getSetting("Email: SMTP Host");
$username = $this->settings->getSetting("Email: SMTP User");
$password = $this->settings->getSetting("Email: SMTP Password");
$port = $this->settings->getSetting("Email: SMTP Port");
$host = $this->settings->getSetting("Email: SMTP Host");
$username = $this->settings->getSetting("Email: SMTP User");
$password = $this->settings->getSetting("Email: SMTP Password");
$port = $this->settings->getSetting("Email: SMTP Port");
if (empty($port)) {
$port = '25';
}
$transport = new \Swift_SmtpTransport($host, $port);
$mail = new \Swift_Message();
if (empty($port)) {
$port = '25';
}
$transport = new \Swift_SmtpTransport($host, $port);
$mail = new \Swift_Message();
if ($this->settings->getSetting("Email: SMTP Authentication Required") === "1") {
$transport->setUsername($username);
$transport->setPassword($password);
}
if ($this->settings->getSetting("Email: SMTP Authentication Required") === "1") {
$transport->setUsername($username);
$transport->setPassword($password);
}
$mail->addFrom($fromEmail, $fromName);
$mail->addReplyTo($replyToEmail);
$mail->addTo($toEmail);
$mail->setSubject($subject);
$mail->setCc($ccList);
$mail->setBcc($bccList);
$mail->setBody($body);
$mail->addFrom($fromEmail, $fromName);
$mail->addReplyTo($replyToEmail);
$mail->addTo($toEmail);
$mail->setSubject($subject);
$mail->setCc($ccList);
$mail->setBcc($bccList);
$mail->setBody($body);
$mailer = new \Swift_Mailer($transport);
return $mailer->send($mail);
} catch (\Exception $e) {
LogManager::getInstance()->error("Error sending email:" . $e->getMessage());
return false;
}
}
$mailer = new \Swift_Mailer($transport);
return $mailer->send($mail);
} catch (\Exception $e) {
LogManager::getInstance()->error("Error sending email:" . $e->getMessage());
return false;
}
}
}