- Adds "reply to" option to all mailers

- Replaces WPMail with Swift using local transport (PHP mail)
- Fixes AmazonSES region naming convention
- Updates tests
This commit is contained in:
Vlad
2016-01-26 18:43:23 -05:00
parent 91981cc324
commit 0776e9ad73
19 changed files with 378 additions and 292 deletions

View File

@@ -10,21 +10,21 @@ class SMTP {
public $login;
public $password;
public $encryption;
public $from_name;
public $from_email;
public $sender;
public $reply_to;
public $mailer;
function __construct(
$host, $port, $authentication, $login = null, $password = null, $encryption,
$from_email, $from_name) {
$sender, $reply_to) {
$this->host = $host;
$this->port = $port;
$this->authentication = $authentication;
$this->login = $login;
$this->password = $password;
$this->encryption = $encryption;
$this->from_name = $from_name;
$this->from_email = $from_email;
$this->sender = $sender;
$this->reply_to = $reply_to;
$this->mailer = $this->buildMailer();
}
@@ -50,11 +50,15 @@ class SMTP {
return \Swift_Mailer::newInstance($transport);
}
function createMessage($newsletter, $subscriber) {
$message = \Swift_Message::newInstance()
->setFrom(array($this->from_email => $this->from_name))
->setTo($this->processSubscriber($subscriber))
->setFrom(array(
$this->sender['from_email'] => $this->sender['from_name']
))
->setReplyTo(array(
$this->reply_to['reply_to_email'] => $this->reply_to['reply_to_name']
))
->setSubject($newsletter['subject']);
if(!empty($newsletter['body']['html'])) {
$message = $message->setBody($newsletter['body']['html'], 'text/html');