diff --git a/lib/Mailer/SMTP.php b/lib/Mailer/SMTP.php index a71601f363..4d34788481 100644 --- a/lib/Mailer/SMTP.php +++ b/lib/Mailer/SMTP.php @@ -4,11 +4,13 @@ namespace MailPoet\Mailer; if(!defined('ABSPATH')) exit; class SMTP { - function __construct($host, $port, $authentication, $encryption, + function __construct($host, $port, $authentication, $login = null, $password = null, $encryption, $fromEmail, $fromName) { $this->host = $host; $this->port = $port; $this->authentication = $authentication; + $this->login = $login; + $this->password = $password; $this->encryption = $encryption; $this->fromName = $fromName; $this->fromEmail = $fromEmail; @@ -20,6 +22,7 @@ class SMTP { $message = $this->createMessage($newsletter, $subscriber); $result = $this->mailer->send($message); } catch(\Exception $e) { + !d($e->getMessage());exit; $result = false; } return ($result === 1); @@ -31,8 +34,8 @@ class SMTP { $transport->setTimeout(10); if($this->authentication) { $transport - ->setUsername($this->authentication['login']) - ->setPassword($this->authentication['password']); + ->setUsername($this->login) + ->setPassword($this->password); } return \Swift_Mailer::newInstance($transport); } diff --git a/lib/Router/Mailer.php b/lib/Router/Mailer.php index b60f1cbc9c..490417c592 100644 --- a/lib/Router/Mailer.php +++ b/lib/Router/Mailer.php @@ -137,6 +137,8 @@ class Mailer { $mailer['host'], $mailer['port'], $mailer['authentication'], + $mailer['login'], + $mailer['password'], $mailer['encryption'], $fromEmail, $fromName