You are here

function hubspot_mail in HubSpot 8

Same name and namespace in other branches
  1. 6.2 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().

File

./hubspot.module, line 79
Sends Webform results to HubSpot's Forms API.

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.', [
        '@form' => $params['node_title'],
      ]);
      break;
    case 'hub_error':
      $message['body'][] = t('Upon submitting the Webform "@form" to HubSpot, an error was returned.', [
        '@form' => $params['node_title'],
      ]);
      break;
  }
  $message['body'][] = t('Error message: @message', [
    '@message' => $params['errormsg'],
  ]);
  $message['body'][] = t('HubSpot POST URL: @url', [
    '@url' => $params['hubspot_url'],
  ]);
  $message['body'][] = t('To adjust the debugging settings, visit @url', [
    '@url' => Url::fromRoute('hubspot.admin_settings')
      ->toString(),
  ]);
}