You are here

function email_confirmer_user_mail in Email confirmer 8

Implements hook_mail().

File

email_confirmer_user/email_confirmer_user.module, line 174
Users related email confirmation module.

Code

function email_confirmer_user_mail($key, &$message, $params) {
  switch ($key) {
    case 'notify_current':
      $context = $params['context'];

      // @todo recipient name?
      $message['to'] = $context['user']
        ->getEmail();
      $message['subject'] = \Drupal::token()
        ->replace(t('Email change request for your user account at [site:name]'), $context, [
        'sanitize' => FALSE,
      ]);
      $message['body'][] = \Drupal::token()
        ->replace(t('A request to change your email address has been made at [site:name]. In order to confirm the update of your email address you will need to follow the instructions sent to your new email address.'), $context, [
        'sanitize' => FALSE,
      ]);
      break;
  }
}