You are here

public function DevelMailLoggerController::sendMail in Devel Mail Logger 8

Send a test mail to current user.

Return value

[type] [description]

1 string reference to 'DevelMailLoggerController::sendMail'
devel_mail_logger.routing.yml in ./devel_mail_logger.routing.yml
devel_mail_logger.routing.yml

File

src/Controller/DevelMailLoggerController.php, line 193

Class

DevelMailLoggerController
Class DevelMailLoggerController.

Namespace

Drupal\devel_mail_logger\Controller

Code

public function sendMail() {
  $module = 'devel_mail_logger';
  $key = 'send_test';
  $to = \Drupal::currentUser()
    ->getEmail();
  $params['message'] = 'body';
  $params['subject'] = 'subject';
  $langcode = \Drupal::currentUser()
    ->getPreferredLangcode();
  $send = TRUE;
  $result = $this->pluginManagerMail
    ->mail($module, $key, $to, $langcode, $params, NULL, $send);
  return [
    '#markup' => t('Mail sent.'),
  ];
}