if (!isset($_POST[$field]) || !$_POST[$field]) {
$errors[] = $msg;
}
}
if (!is_numeric($_POST['list'])) {
$errors[] = 'You must select a list.';
}
if ($_POST['schedule_time'] && strtotime($_POST['schedule_time']) == FALSE) {
$errors[] = 'Invalid schedule time.';
}
if (!count($errors)) {
$lists = sailthru_form::get_all_lists();
$list = $lists[$_POST['list']];
require_once 'client/requires.php';
$client = new Sailthru_Client(get_option('sailthru_api_key'), get_option('sailthru_secret'));
$r = $client->scheduleBlast($_POST['blast_name'], $list, $_POST['schedule_time'], $_POST['from_name'], $_POST['from_email'], $_POST['subject'], $_POST['content'], $_POST['plaintext_body'], array("report_email" => $_POST['report_email']));
if ($r['status'] == 'scheduled') {
$errors[] = 'Your blast has been successfully scheduled for: ' . $r['schedule_time'];
update_option('triggermail_last_blast', $_POST);
} else {
$errors[] = $r['errormsg'];
}
}
} else {
//no post..
$_POST = get_option('triggermail_last_blast');
}
?>
<a href="options-general.php?page=sailthru&action=forms">Edit Forms</a> | Send an Email Blast | <a href="options-general.php?page=sailthru&action=options">General Options</a> | <a href="options-general.php?page=sailthru&action=datafeeds">Manage Datafeeds</a>
<?php
if (isset($errors) && is_array($errors) && count($errors)) {