You are here

function civicrm_entity_price_set_field_send_contribution_receipt in CiviCRM Entity 7.2

Sends confirmation email for a Contribution using CiviCRM API sendconfirmation action

Parameters

$contribution_id:

$from_address:

File

modules/civicrm_entity_price_set_field/civicrm_entity_price_set_field.module, line 99

Code

function civicrm_entity_price_set_field_send_contribution_receipt($contribution_id, $from_address) {
  if (!civicrm_initialize()) {
    return;
  }
  if (!empty($contribution_id) && $contribution_id > 0 && $from_address != '') {
    try {
      $result = civicrm_api3('Contribution', 'sendconfirmation', array(
        'sequential' => 1,
        'id' => $contribution_id,
        'receipt_from_email' => $from_address,
      ));
    } catch (CiviCRM_API3_Exception $e) {
      watchdog('civicrm_entity_price_set_field', 'Contribution Receipt sending failed');
    }
  }
  else {
    watchdog('civicrm_entity_price_set_field', 'Invalid values for provided parameters.');
  }
}