class VariableLog

Defines a mail sending implementation that captures sent messages to a variable.

This class is for running tests or for development.

Hierarchy

Expanded class hierarchy of VariableLog

File

drupal/core/lib/Drupal/Core/Mail/VariableLog.php, line 16
Definition of Drupal\Core\Mail\VariableLog.

Namespace

Drupal\Core\Mail
View source
class VariableLog extends PhpMail implements MailInterface {

  /**
   * Overrides Drupal\Core\Mail\PhpMail::mail().
   *
   * Accepts an e-mail message and store it in a variable.
   */
  public function mail(array $message) {
    $captured_emails = \Drupal::state()
      ->get('system.test_email_collector') ?: array();
    $captured_emails[] = $message;
    \Drupal::state()
      ->set('system.test_email_collector', $captured_emails);
    return TRUE;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PhpMail::format public function Concatenates and wraps the e-mail body for plain-text mails. Overrides MailInterface::format
VariableLog::mail public function Overrides Drupal\Core\Mail\PhpMail::mail(). Overrides PhpMail::mail