function easy_email_mail in Easy Email 8
Same name and namespace in other branches
- 2.0.x easy_email.module \easy_email_mail()
Implements hook_mail().
File
- ./
easy_email.module, line 128 - Contains easy_email.module.
Code
function easy_email_mail($key, &$message, $params) {
/** @var \Drupal\Core\Render\RendererInterface $renderer */
$renderer = \Drupal::service('renderer');
if (isset($params['headers'])) {
$message['headers'] = array_merge($message['headers'], $params['headers']);
}
if (!empty($params['from'])) {
$message['from'] = $params['from'];
}
$message['subject'] = $params['subject'];
$message['body'][] = $renderer
->render($params['body']);
if (!empty($params['plain'])) {
$message['plain'] = $renderer
->render($params['plain']);
}
}