Add meta to test emails
[MAILPOET-2333]
This commit is contained in:
committed by
Jack Kitterhing
parent
5a3994ab5d
commit
8594645e0d
@ -6,6 +6,7 @@ use MailPoet\API\JSON\Endpoint as APIEndpoint;
|
||||
use MailPoet\API\JSON\Error as APIError;
|
||||
use MailPoet\Config\AccessControl;
|
||||
use MailPoet\Mailer\MailerLog;
|
||||
use MailPoet\Mailer\MetaInfo;
|
||||
use MailPoet\Services\AuthorizedEmailsController;
|
||||
use MailPoet\Services\Bridge;
|
||||
use MailPoet\Settings\SettingsController;
|
||||
@ -22,14 +23,18 @@ class Mailer extends APIEndpoint {
|
||||
/** @var SettingsController */
|
||||
private $settings;
|
||||
|
||||
/** @var MetaInfo */
|
||||
private $mailerMetaInfo;
|
||||
|
||||
public $permissions = [
|
||||
'global' => AccessControl::PERMISSION_MANAGE_EMAILS,
|
||||
];
|
||||
|
||||
function __construct(AuthorizedEmailsController $authorized_emails_controller, SettingsController $settings, Bridge $bridge) {
|
||||
function __construct(AuthorizedEmailsController $authorized_emails_controller, SettingsController $settings, Bridge $bridge, MetaInfo $mailerMetaInfo) {
|
||||
$this->authorized_emails_controller = $authorized_emails_controller;
|
||||
$this->settings = $settings;
|
||||
$this->bridge = $bridge;
|
||||
$this->mailerMetaInfo = $mailerMetaInfo;
|
||||
}
|
||||
|
||||
function send($data = []) {
|
||||
@ -40,7 +45,10 @@ class Mailer extends APIEndpoint {
|
||||
(isset($data['sender'])) ? $data['sender'] : false,
|
||||
(isset($data['reply_to'])) ? $data['reply_to'] : false
|
||||
);
|
||||
$result = $mailer->send($data['newsletter'], $data['subscriber']);
|
||||
$extra_params = [
|
||||
'meta' => $this->mailerMetaInfo->getSendingTestMetaInfo(),
|
||||
];
|
||||
$result = $mailer->send($data['newsletter'], $data['subscriber'], $extra_params);
|
||||
} catch (\Exception $e) {
|
||||
return $this->errorResponse([
|
||||
$e->getCode() => $e->getMessage(),
|
||||
|
Reference in New Issue
Block a user