public function TestMailCollector::mail in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Mail/Plugin/Mail/TestMailCollector.php \Drupal\Core\Mail\Plugin\Mail\TestMailCollector::mail()
Sends an email message.
Parameters
array $message: A message array, as described in hook_mail_alter().
Return value
bool TRUE if the mail was successfully accepted, otherwise FALSE.
Overrides PhpMail::mail
See also
http://php.net/manual/en/function.mail.php
\Drupal\Core\Mail\MailManagerInterface::mail()
File
- core/
lib/ Drupal/ Core/ Mail/ Plugin/ Mail/ TestMailCollector.php, line 28 - Contains \Drupal\Core\Mail\Plugin\Mail\TestMailCollector.
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') ?: array();
$captured_emails[] = $message;
\Drupal::state()
->set('system.test_mail_collector', $captured_emails);
return TRUE;
}