Exemplo n.º 1
0
/**
 * Handle a reply event.
 *
 * @param array $params
 *
 * @return array
 */
function civicrm_api3_mailing_event_reply($params)
{
    $job = $params['job_id'];
    $queue = $params['event_queue_id'];
    $hash = $params['hash'];
    $replyto = $params['replyTo'];
    $bodyTxt = CRM_Utils_Array::value('bodyTxt', $params);
    $bodyHTML = CRM_Utils_Array::value('bodyHTML', $params);
    $fullEmail = CRM_Utils_Array::value('fullEmail', $params);
    $mailing = CRM_Mailing_Event_BAO_Reply::reply($job, $queue, $hash, $replyto);
    if (empty($mailing)) {
        return civicrm_api3_create_error('Queue event could not be found');
    }
    CRM_Mailing_Event_BAO_Reply::send($queue, $mailing, $bodyTxt, $replyto, $bodyHTML, $fullEmail);
    return civicrm_api3_create_success($params);
}
Exemplo n.º 2
0
/**
 * Handle a reply event
 *
 * @param int $job_id           The job ID
 * @param int $queue_id         The queue event ID
 * @param string $hash          Security hash
 * @param string $body          Body of the reply message
 * @param string $replyto       Reply-to of the incoming message
 * @return boolean              True on success
 */
function crm_mailer_event_reply($job_id, $queue_id, $hash, $body, $replyto)
{
    $mailing =& CRM_Mailing_Event_BAO_Reply::reply($job_id, $queue_id, $hash, $replyto);
    if (empty($mailing)) {
        return false;
    }
    CRM_Mailing_Event_BAO_Reply::send($queue_id, $mailing, $body, $replyto);
    return true;
}
Exemplo n.º 3
0
/**
 * Handle a reply event
 *
 * @param array $params
 *
 * @return array
 */
function civicrm_mailer_event_reply($params)
{
    $errors = _civicrm_mailer_check_params($params, array('job_id', 'event_queue_id', 'hash', 'replyTo'));
    if (!empty($errors)) {
        return $errors;
    }
    // CRM-7333: we can’t require fullEmail for backwards compatibility, but we should require either it or bodyTxt
    if (empty($params['fullEmail']) and empty($params['bodyTxt'])) {
        return civicrm_create_error('Required parameter missing: either "fullEmail" or "bodyTxt" is required');
    }
    $job = $params['job_id'];
    $queue = $params['event_queue_id'];
    $hash = $params['hash'];
    $bodyTxt = $params['bodyTxt'];
    $replyto = $params['replyTo'];
    $bodyHTML = CRM_Utils_Array::value('bodyHTML', $params);
    $fullEmail = CRM_Utils_Array::value('fullEmail', $params);
    $mailing = CRM_Mailing_Event_BAO_Reply::reply($job, $queue, $hash, $replyto);
    if (empty($mailing)) {
        return civicrm_create_error(ts('Queue event could not be found'));
    }
    CRM_Mailing_Event_BAO_Reply::send($queue, $mailing, $bodyTxt, $replyto, $bodyHTML, $fullEmail);
    return civicrm_create_success();
}
Exemplo n.º 4
0
/**
 * Handle a reply event
 *
 * @param int $job_id           The job ID
 * @param int $queue_id         The queue event ID
 * @param string $hash          Security hash
 * @param string $bodyTxt       text part of the body (ignored if $fullEmail supplied)
 * @param string $replyto       Reply-to of the incoming message
 * @param string $bodyHTML      HTML part of the body (ignored if $fullEmail supplied)
 * @param string $fullEmail     whole email to forward in one string
 * @return boolean              True on success
 */
function crm_mailer_event_reply($job_id, $queue_id, $hash, $bodyTxt, $replyto, $bodyHTML = null, $fullEmail = null)
{
    $mailing =& CRM_Mailing_Event_BAO_Reply::reply($job_id, $queue_id, $hash, $replyto);
    if (empty($mailing)) {
        return false;
    }
    CRM_Mailing_Event_BAO_Reply::send($queue_id, $mailing, $bodyTxt, $replyto, $bodyHTML, $fullEmail);
    return true;
}