Bugfixes on sending

- added checks to prevent adding to the queue useless items
- fixed issue with mta settings (duplicated "host" input / renamed duplicate to "domain" for MailGun)
- fixed namespace issue on cron daemon/supervisor
- fixed typo in migration preventing the newsletter_templates table to be created.
- partially fixed cron.jsx
This commit is contained in:
Jonathan Labreuille
2015-12-07 13:29:42 +01:00
parent c0ba218949
commit 268dabdc9f
8 changed files with 132 additions and 108 deletions

View File

@@ -9,6 +9,19 @@ if(!defined('ABSPATH')) exit;
class SendingQueue {
function add($data) {
// check if mailer is properly configured
try {
new Mailer(false);
} catch(\Exception $e) {
wp_send_json(
array(
'result' => false,
'errors' => array($e->getMessage())
)
);
exit;
}
$queue = \MailPoet\Models\SendingQueue::where('newsletter_id', $data['newsletter_id'])
->whereNull('status')
->findArray();
@@ -34,6 +47,17 @@ class SendingQueue {
'id'
));
}
if(empty($subscriber_ids)) {
wp_send_json(
array(
'result' => false,
'errors' => array(__('There are no subscribers.'))
)
);
exit;
}
$subscriber_ids = array_unique($subscriber_ids);
$queue->subscribers = json_encode(
array(