function TestMailCollector::mail
Same name in other branches
- 9 core/lib/Drupal/Core/Mail/Plugin/Mail/TestMailCollector.php \Drupal\Core\Mail\Plugin\Mail\TestMailCollector::mail()
- 8.9.x core/lib/Drupal/Core/Mail/Plugin/Mail/TestMailCollector.php \Drupal\Core\Mail\Plugin\Mail\TestMailCollector::mail()
- 10 core/lib/Drupal/Core/Mail/Plugin/Mail/TestMailCollector.php \Drupal\Core\Mail\Plugin\Mail\TestMailCollector::mail()
Overrides PhpMail::mail
File
-
core/
lib/ Drupal/ Core/ Mail/ Plugin/ Mail/ TestMailCollector.php, line 24
Class
- TestMailCollector
- Defines a mail backend that captures sent messages in the state system.
Namespace
Drupal\Core\Mail\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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.