You are here

public function HTMLTestingMailSystem::mail in Contact Storage 8

Implements MailSystemInterface::mail().

Overrides MailInterface::mail

File

src/Plugin/Mail/HTMLTestingMailSystem.php, line 35

Class

HTMLTestingMailSystem
A mail sending implementation that captures sent messages to a variable.

Namespace

Drupal\contact_storage\Plugin\Mail

Code

public function mail(array $message) {
  $captured_emails = \Drupal::state()
    ->get('system.test_mail_collector') ?: [];
  $captured_emails[] = $message;
  \Drupal::state()
    ->set('system.test_mail_collector', $captured_emails);
  return TRUE;
}