You are here

public function HTMLTestingMailSystem::mail in Simplenews 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Mail/HTMLTestingMailSystem.php \Drupal\simplenews\Plugin\Mail\HTMLTestingMailSystem::mail()
  2. 3.x src/Plugin/Mail/HTMLTestingMailSystem.php \Drupal\simplenews\Plugin\Mail\HTMLTestingMailSystem::mail()

Implements MailSystemInterface::mail().

Overrides MailInterface::mail

File

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

Class

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

Namespace

Drupal\simplenews\Plugin\Mail

Code

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