You are here

class TestingMailSystem in Drupal 7

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 TestingMailSystem

1 string reference to 'TestingMailSystem'
DrupalWebTestCase::setUp in modules/simpletest/drupal_web_test_case.php
Sets up a Drupal site for running functional and integration tests.

File

modules/system/system.mail.inc, line 151
Drupal core implementations of MailSystemInterface.

View source
class TestingMailSystem extends DefaultMailSystem implements MailSystemInterface {

  /**
   * Accept an e-mail message and store it in a variable.
   *
   * @param $message
   *   An e-mail message.
   */
  public function mail(array $message) {
    $captured_emails = variable_get('drupal_test_email_collector', array());
    $captured_emails[] = $message;
    variable_set('drupal_test_email_collector', $captured_emails);
    return TRUE;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DefaultMailSystem::format public function Concatenate and wrap the e-mail body for plain-text mails. Overrides MailSystemInterface::format
DefaultMailSystem::_isShellSafe protected static function Disallows potentially unsafe shell characters.
TestingMailSystem::mail public function Accept an e-mail message and store it in a variable. Overrides DefaultMailSystem::mail