function SystemHooks::mail

Implements hook_mail().

File

core/modules/system/src/Hook/SystemHooks.php, line 355

Class

SystemHooks
Hook implementations for system.

Namespace

Drupal\system\Hook

Code

public function 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.