You are here

function hubspot_mail in HubSpot 6.2

Same name and namespace in other branches
  1. 8 hubspot.module \hubspot_mail()
  2. 6 hubspot.module \hubspot_mail()
  3. 7 hubspot.module \hubspot_mail()
  4. 3.x hubspot.module \hubspot_mail()

Implements hook_mail() to send error messages to the administrator.

File

./hubspot.module, line 147
Sends Webform results to HubSpot's Leads API by using Webform's provided hooks.

Code

function hubspot_mail($key, &$message, $params) {
  $message['subject'] = t('HubSpot leads insertion error');
  switch ($key) {
    case 'http_error':
      $message['body'][] = t('When attempting to submit the form "@form" to HubSpot, a HTTP error occurred.', array(
        '@form' => $params['node_title'],
      ));
      break;
    case 'hub_error':
      $message['body'][] = t('Upon submitting the Webform "@form" to HubSpot, an error was returned.', array(
        '@form' => $params['node_title'],
      ));
      break;
  }
  $message['body'][] = t('Error message: @message', array(
    '@message' => $params['errormsg'],
  ));
  $message['body'][] = t('HubSpot POST URL: @url', array(
    '@url' => $params['hubspot_url'],
  ));
  $message['body'][] = t('To adjust the debugging settings, visit @url', array(
    '@url' => url('admin/config/content/hubspot', array(
      'absolute' => TRUE,
    )),
  ));
}