Add blacklist to Mailer [MAILPOET-2176]

This commit is contained in:
wxa
2019-07-10 13:14:00 +03:00
committed by Jan Jakeš
parent 84fabcfbd5
commit 9018ab8c5f
13 changed files with 125 additions and 0 deletions

View File

@@ -10,6 +10,8 @@ if (!defined('ABSPATH')) exit;
require_once ABSPATH . WPINC . '/class-phpmailer.php';
class PHPMail {
use BlacklistTrait;
public $sender;
public $reply_to;
public $return_path;
@@ -29,6 +31,10 @@ class PHPMail {
}
function send($newsletter, $subscriber, $extra_params = []) {
if ($this->isBlacklisted($subscriber)) {
$error = $this->error_mapper->getBlacklistError($subscriber);
return Mailer::formatMailerErrorResult($error);
}
try {
$mailer = $this->configureMailerWithMessage($newsletter, $subscriber, $extra_params);
$result = $mailer->send();