You are here

function mailsystem_test_mail in Mail System 8.4

Implements hook_mail().

File

tests/modules/mailsystem_test/mailsystem_test.module, line 14
Enables the use of personal and site-wide contact forms.

Code

function mailsystem_test_mail($key, &$message, $params) {
  switch ($key) {
    case 'theme_test':
      $account = User::load(\Drupal::currentUser()
        ->id());
      $username = [
        '#theme' => 'username',
        '#account' => $account,
      ];
      $message['subject'] = new TranslatableMarkup('Testing mail theme.');
      $message['body'][] = (string) \Drupal::service('renderer')
        ->renderPlain($username);
      break;
  }
}