class QueueMailTestMailCollector in Queue Mail 8
QueueMailTestMailCollector class.
Defines a mail backend that captures sent and formatted messages in the state system.
Hierarchy
- class \Drupal\Core\Mail\Plugin\Mail\PhpMail implements MailInterface
- class \Drupal\Core\Mail\Plugin\Mail\TestMailCollector implements MailInterface
- class \Drupal\queue_mail_test\Plugin\Mail\QueueMailTestMailCollector
- class \Drupal\Core\Mail\Plugin\Mail\TestMailCollector implements MailInterface
Expanded class hierarchy of QueueMailTestMailCollector
1 file declares its use of QueueMailTestMailCollector
- queue_mail_test.module in tests/
modules/ queue_mail_test/ queue_mail_test.module - Module for testing the Queue Mail module.
File
- tests/
modules/ queue_mail_test/ src/ Plugin/ Mail/ QueueMailTestMailCollector.php, line 13
Namespace
Drupal\queue_mail_test\Plugin\MailView source
class QueueMailTestMailCollector extends TestMailCollector {
/**
* {@inheritdoc}
*/
public function format(array $message) {
$message = parent::format($message);
$message['current_langcode'] = \Drupal::languageManager()
->getCurrentLanguage()
->getId();
return $message;
}
/**
* {@inheritdoc}
*/
public function mail(array $message) {
$result = parent::mail($message);
if ($message['key'] == 'fail_message') {
$result = FALSE;
}
return $result;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PhpMail:: |
protected | property | The configuration factory. | |
PhpMail:: |
protected static | function | Disallows potentially unsafe shell characters. | |
PhpMail:: |
public | function | PhpMail constructor. | |
QueueMailTestMailCollector:: |
public | function |
Concatenates and wraps the email body for plain-text mails. Overrides PhpMail:: |
|
QueueMailTestMailCollector:: |
public | function |
Sends an email message. Overrides TestMailCollector:: |