You are here

function email_contact_mail in Email Contact 8

Same name and namespace in other branches
  1. 7 email_contact.module \email_contact_mail()

Implements hook_mail().

1 string reference to 'email_contact_mail'
ContactForm::getFormId in src/Form/ContactForm.php
Returns a unique string identifying the form.

File

./email_contact.module, line 66
Email Contact module file.

Code

function email_contact_mail($key, &$message, $params) {
  switch ($key) {
    case 'contact':

      // Compose the body.
      $token = Drupal::token();
      $message['body'][] = $token
        ->replace($params['default_message']);
      $message['body'][] = $params['message'];
      $message['subject'] = "";

      // Include the title of the entity, if one exists.
      $message['subject'] .= " " . Html::escape($params['subject']);
      break;
  }
}