You are here

function mandrill_add_webhook in Mandrill 7.2

Same name and namespace in other branches
  1. 8 mandrill.module \mandrill_add_webhook()

Create a new webhook.

File

./mandrill.module, line 531
Enables Drupal to send email directly through Mandrill.

Code

function mandrill_add_webhook($path, $events, $description = 'Drupal Webhook') {
  $result = NULL;
  try {
    if ($mandrill = mandrill_get_api_object()) {
      $result = $mandrill->webhooks
        ->add($GLOBALS['base_url'] . '/' . $path, $description, $events);
    }
  } catch (Mandrill_Error $e) {
    drupal_set_message(t('Mandrill: %message', array(
      '%message' => $e
        ->getMessage(),
    )), 'error');
    watchdog_exception('mandrill', $e);
  }
  return $result;
}