function system_mail

Same name in other branches
  1. 7.x modules/system/system.module \system_mail()
  2. 9 core/modules/system/system.module \system_mail()
  3. 8.9.x core/modules/system/system.module \system_mail()
  4. 11.x core/modules/system/system.module \system_mail()

Implements hook_mail().

File

core/modules/system/system.module, line 1046

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.