W3cubDocs

/Drupal 8

function system_mail

system_mail($key, &$message, $params)

Implements hook_mail().

File

core/modules/system/system.module, line 1308
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(array("\r", "\n"), '', $subject);
  $message['body'][] = $body;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!system!system.module/function/system_mail/8.1.x