Files
piratepoet/lib/API/Endpoints/Mailer.php
Jonathan Labreuille 2e88d7cce0 Added API/Endpoint abstract class
- (re)Added Endpoints folder to both API and Router
- fixed syntax in namespaces
- xhr.responseJSON is returned to the fail()
- fixed Router endpoints (view in browser, cron,...)
2016-08-02 17:08:43 +02:00

23 lines
647 B
PHP

<?php
namespace MailPoet\API\Endpoints;
if(!defined('ABSPATH')) exit;
class Mailer {
function send($data) {
$response = array();
try {
$mailer = new \MailPoet\Mailer\Mailer(
(isset($data['mailer'])) ? $data['mailer'] : false,
(isset($data['sender'])) ? $data['sender'] : false,
(isset($data['reply_to'])) ? $data['reply_to'] : false
);
$result = $mailer->send($data['newsletter'], $data['subscriber']);
} catch(\Exception $e) {
$result = false;
$response['errors'] = array($e->getMessage());
}
$response['result'] = ($result) ? true : false;
return $response;
}
}