class TestPhpMailFailure
Same name in other branches
- 9 core/modules/system/tests/modules/system_mail_failure_test/src/Plugin/Mail/TestPhpMailFailure.php \Drupal\system_mail_failure_test\Plugin\Mail\TestPhpMailFailure
- 8.9.x core/modules/system/tests/modules/system_mail_failure_test/src/Plugin/Mail/TestPhpMailFailure.php \Drupal\system_mail_failure_test\Plugin\Mail\TestPhpMailFailure
- 11.x core/modules/system/tests/modules/system_mail_failure_test/src/Plugin/Mail/TestPhpMailFailure.php \Drupal\system_mail_failure_test\Plugin\Mail\TestPhpMailFailure
Defines a mail sending implementation that always fails.
This class is for running tests or for development. To use set the configuration:
\Drupal::configFactory()->getEditable('system.mail')
->set('interface.default', 'test_php_mail_failure')
->save();
Hierarchy
- class \Drupal\Core\Mail\Plugin\Mail\PhpMail implements \Drupal\Core\Mail\MailInterface
- class \Drupal\system_mail_failure_test\Plugin\Mail\TestPhpMailFailure extends \Drupal\Core\Mail\Plugin\Mail\PhpMail implements \Drupal\Core\Mail\MailInterface
Expanded class hierarchy of TestPhpMailFailure
1 file declares its use of TestPhpMailFailure
- MailTest.php in core/
modules/ system/ tests/ src/ Kernel/ Mail/ MailTest.php
File
-
core/
modules/ system/ tests/ modules/ system_mail_failure_test/ src/ Plugin/ Mail/ TestPhpMailFailure.php, line 19
Namespace
Drupal\system_mail_failure_test\Plugin\MailView source
class TestPhpMailFailure extends PhpMail implements MailInterface {
/**
* {@inheritdoc}
*/
public function mail(array $message) {
// Simulate a failed mail send by returning FALSE.
return FALSE;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
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::format | public | function | Concatenates and wraps the email body for plain-text mails. | Overrides MailInterface::format | 1 |
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. | ||
TestPhpMailFailure::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.