function MailManager::mail
Same name in other branches
- 9 core/lib/Drupal/Core/Mail/MailManager.php \Drupal\Core\Mail\MailManager::mail()
- 10 core/lib/Drupal/Core/Mail/MailManager.php \Drupal\Core\Mail\MailManager::mail()
- 11.x core/lib/Drupal/Core/Mail/MailManager.php \Drupal\Core\Mail\MailManager::mail()
Overrides MailManagerInterface::mail
File
-
core/
lib/ Drupal/ Core/ Mail/ MailManager.php, line 172
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 e-mails 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);
});
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.