public function HTMLTestingMailSystem::mail in Simplenews 8.2
Same name and namespace in other branches
- 8 src/Plugin/Mail/HTMLTestingMailSystem.php \Drupal\simplenews\Plugin\Mail\HTMLTestingMailSystem::mail()
- 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\MailCode
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;
}