- Fixes SMTP issue
This commit is contained in:
@@ -4,11 +4,13 @@ namespace MailPoet\Mailer;
|
|||||||
if(!defined('ABSPATH')) exit;
|
if(!defined('ABSPATH')) exit;
|
||||||
|
|
||||||
class SMTP {
|
class SMTP {
|
||||||
function __construct($host, $port, $authentication, $encryption,
|
function __construct($host, $port, $authentication, $login = null, $password = null, $encryption,
|
||||||
$fromEmail, $fromName) {
|
$fromEmail, $fromName) {
|
||||||
$this->host = $host;
|
$this->host = $host;
|
||||||
$this->port = $port;
|
$this->port = $port;
|
||||||
$this->authentication = $authentication;
|
$this->authentication = $authentication;
|
||||||
|
$this->login = $login;
|
||||||
|
$this->password = $password;
|
||||||
$this->encryption = $encryption;
|
$this->encryption = $encryption;
|
||||||
$this->fromName = $fromName;
|
$this->fromName = $fromName;
|
||||||
$this->fromEmail = $fromEmail;
|
$this->fromEmail = $fromEmail;
|
||||||
@@ -20,6 +22,7 @@ class SMTP {
|
|||||||
$message = $this->createMessage($newsletter, $subscriber);
|
$message = $this->createMessage($newsletter, $subscriber);
|
||||||
$result = $this->mailer->send($message);
|
$result = $this->mailer->send($message);
|
||||||
} catch(\Exception $e) {
|
} catch(\Exception $e) {
|
||||||
|
!d($e->getMessage());exit;
|
||||||
$result = false;
|
$result = false;
|
||||||
}
|
}
|
||||||
return ($result === 1);
|
return ($result === 1);
|
||||||
@@ -31,8 +34,8 @@ class SMTP {
|
|||||||
$transport->setTimeout(10);
|
$transport->setTimeout(10);
|
||||||
if($this->authentication) {
|
if($this->authentication) {
|
||||||
$transport
|
$transport
|
||||||
->setUsername($this->authentication['login'])
|
->setUsername($this->login)
|
||||||
->setPassword($this->authentication['password']);
|
->setPassword($this->password);
|
||||||
}
|
}
|
||||||
return \Swift_Mailer::newInstance($transport);
|
return \Swift_Mailer::newInstance($transport);
|
||||||
}
|
}
|
||||||
|
@@ -137,6 +137,8 @@ class Mailer {
|
|||||||
$mailer['host'],
|
$mailer['host'],
|
||||||
$mailer['port'],
|
$mailer['port'],
|
||||||
$mailer['authentication'],
|
$mailer['authentication'],
|
||||||
|
$mailer['login'],
|
||||||
|
$mailer['password'],
|
||||||
$mailer['encryption'],
|
$mailer['encryption'],
|
||||||
$fromEmail,
|
$fromEmail,
|
||||||
$fromName
|
$fromName
|
||||||
|
Reference in New Issue
Block a user