public function MailsystemTestController::sendMail in Mail System 8.4
Composes and optionally sends an email message.
Return value
\Symfony\Component\HttpFoundation\RedirectResponse The redirect response object.
1 string reference to 'MailsystemTestController::sendMail'
- mailsystem_test.routing.yml in tests/
modules/ mailsystem_test/ mailsystem_test.routing.yml - tests/modules/mailsystem_test/mailsystem_test.routing.yml
File
- tests/
modules/ mailsystem_test/ src/ Controller/ MailsystemTestController.php, line 18
Class
- MailsystemTestController
- A mailsystem test controller for use by tests in this file.
Namespace
Drupal\mailsystem_test\ControllerCode
public function sendMail() {
// Explicitly render something to initialize the theme registry to make
// sure that an initialized theme registry is properly switched.
$render = [
'#theme' => 'item_list',
];
\Drupal::service('renderer')
->render($render);
$module = 'mailsystem_test';
$key = 'theme_test';
$to = 'theme_test@example.com';
$langcode = \Drupal::languageManager()
->getDefaultLanguage()
->getId();
\Drupal::service('plugin.manager.mail')
->mail($module, $key, $to, $langcode);
return new Response('', 204);
}