class TestHtmlMailCollector

Same name in other branches
  1. 9 core/modules/system/tests/modules/mail_html_test/src/Plugin/Mail/TestHtmlMailCollector.php \Drupal\mail_html_test\Plugin\Mail\TestHtmlMailCollector
  2. 8.9.x core/modules/system/tests/modules/mail_html_test/src/Plugin/Mail/TestHtmlMailCollector.php \Drupal\mail_html_test\Plugin\Mail\TestHtmlMailCollector
  3. 11.x core/modules/system/tests/modules/mail_html_test/src/Plugin/Mail/TestHtmlMailCollector.php \Drupal\mail_html_test\Plugin\Mail\TestHtmlMailCollector

Defines a mail backend that captures sent HTML messages in the state system.

This class is for running tests or for development and does not convert HTML to plaintext.

Hierarchy

Expanded class hierarchy of TestHtmlMailCollector

File

core/modules/system/tests/modules/mail_html_test/src/Plugin/Mail/TestHtmlMailCollector.php, line 16

Namespace

Drupal\mail_html_test\Plugin\Mail
View source
class TestHtmlMailCollector extends TestMailCollector {
    
    /**
     * {@inheritdoc}
     */
    public function format(array $message) {
        // Join the body array into one string.
        $message['body'] = implode(PHP_EOL, $message['body']);
        // Wrap the mail body for sending.
        $message['body'] = MailFormatHelper::wrapMail($message['body']);
        return $message;
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
PhpMail::$configFactory protected property The configuration factory.
PhpMail::$request protected property The currently active request object.
PhpMail::doMail protected function Wrapper around PHP's mail() function.
PhpMail::MAILBOX_LIST_HEADERS private constant A list of headers that can contain multiple email addresses.
PhpMail::_isShellSafe protected static function Disallows potentially unsafe shell characters.
PhpMail::__construct public function PhpMail constructor.
TestHtmlMailCollector::format public function Concatenates and wraps the email body for plain-text mails. Overrides PhpMail::format
TestMailCollector::mail public function Sends an email message. Overrides PhpMail::mail

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