class TestingMailSystem

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

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

Title Sort descending Modifiers Object type Summary Overriden Title
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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.