You are here

function hubspot_webform_mail in HubSpot 7.2

Same name and namespace in other branches
  1. 7.3 hubspot_webform/hubspot_webform.module \hubspot_webform_mail()

Implements hook_mail().

File

hubspot_webform/hubspot_webform.module, line 154
Sends Webform results to HubSpot's Forms API.

Code

function hubspot_webform_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,
    )),
  ));
}