$mailing = current(PommoMailing::get(array('id' => $_REQUEST['mailings']))); // change group name to ID $groups = PommoGroup::getNames(); $gid = 'all'; foreach ($groups as $group) { if ($group['name'] == $mailing['group']) { $gid = $group['id']; } } PommoAPI::stateReset(array('mailing')); // if this is a plain text mailing, switch body + altbody. if ($mailing['ishtml'] == 'off') { $mailing['altbody'] = $mailing['body']; $mailing['body'] = null; } // Initialize page state with default values overriden by those held in $_REQUEST $state =& PommoAPI::stateInit('mailing', array('fromname' => $mailing['fromname'], 'fromemail' => $mailing['fromemail'], 'frombounce' => $mailing['frombounce'], 'list_charset' => $mailing['charset'], 'mailgroup' => $gid, 'subject' => $mailing['subject'], 'body' => $mailing['body'], 'altbody' => $mailing['altbody'])); Pommo::redirect($pommo->_baseUrl . 'admin/mailings/mailings_start.php'); break; case 'delete': $deleted = PommoMailing::delete($mailingIDS); $logger->addMsg(Pommo::_T('Please Wait') . '...'); $params = $json->encode(array('ids' => $mailingIDS)); $smarty->assign('callbackFunction', 'deleteMailing'); $smarty->assign('callbackParams', $params); break; default: $logger->AddErr('invalid call'); break; } $smarty->display('admin/rpc.tpl');