You are here

function system_mail in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/system/system.module \system_mail()
  2. 6 modules/system/system.module \system_mail()
  3. 7 modules/system/system.module \system_mail()
  4. 10 core/modules/system/system.module \system_mail()

Implements hook_mail().

File

core/modules/system/system.module, line 1089
Configuration system that lets administrators modify the workings of the site.

Code

function system_mail($key, &$message, $params) {
  $token_service = \Drupal::token();
  $context = $params['context'];
  $subject = PlainTextOutput::renderFromHtml($token_service
    ->replace($context['subject'], $context));
  $body = $token_service
    ->replace($context['message'], $context);
  $message['subject'] .= str_replace([
    "\r",
    "\n",
  ], '', $subject);
  $message['body'][] = $body;
}