function MailManager::mail
Overrides MailManagerInterface::mail
File
-
core/
lib/ Drupal/ Core/ Mail/ MailManager.php, line 174
Class
- MailManager
- Provides a Mail plugin manager.
Namespace
Drupal\Core\MailCode
public function mail($module, $key, $to, $langcode, $params = [], $reply = NULL, $send = TRUE) {
// Mailing can invoke rendering (e.g., generating URLs, replacing tokens),
// but emails are not HTTP responses: they're not cached, they don't have
// attachments. Therefore we perform mailing inside its own render context,
// to ensure it doesn't leak into the render context for the HTTP response
// to the current request.
return $this->renderer
->executeInRenderContext(new RenderContext(), function () use ($module, $key, $to, $langcode, $params, $reply, $send) {
return $this->doMail($module, $key, $to, $langcode, $params, $reply, $send);
});
}