/** * Form submission of new/edit contact is processed. * * @access public * @return None */ public function postProcess() { $queue_id = $this->get('queue_id'); $job_id = $this->get('job_id'); $hash = $this->get('hash'); $formValues = $this->controller->exportValues($this->_name); $params = array(); $params['body_text'] = $formValues['forward_comment']; $html_comment = $formValues['html_comment']; $params['body_html'] = str_replace('%7B', '{', str_replace('%7D', '}', $html_comment)); $emails = array(); for ($i = 0; $i < 5; $i++) { $email = $this->controller->exportValue($this->_name, "email_{$i}"); if (!empty($email)) { $emails[] = $email; } } $forwarded = null; foreach ($emails as $email) { $params = array('job_id' => $job_id, 'event_queue_id' => $queue_id, 'hash' => $hash, 'email' => $email, 'fromEmail' => $this->_fromEmail, 'params' => $params); $result = civicrm_mailer_event_forward($params); if ($result) { $forwarded++; } } $status = ts('Mailing is not forwarded to the given email address.', array('count' => count($emails), 'plural' => 'Mailing is not forwarded to the given email addresses.')); if ($forwarded) { $status = ts('Mailing is forwarded successfully to %count email address.', array('count' => $forwarded, 'plural' => 'Mailing is forwarded successfully to %count email addresses.')); } require_once 'CRM/Utils/System.php'; CRM_Utils_System::setUFMessage($status); // always redirect to front page of url $session = CRM_Core_Session::singleton(); $config = CRM_Core_Config::singleton(); $session->pushUserContext($config->userFrameworkBaseURL); }
public function mailer_event_forward($key, $job, $queue, $hash, $email) { $this->verify($key); $params = array('job_id' => $job, 'event_queue_id' => $queue, 'hash' => $hash, 'email' => $email); return civicrm_mailer_event_forward($params); }