You are here

class SkipMailException in Simplenews 8

Same name and namespace in other branches
  1. 8.2 src/SkipMailException.php \Drupal\simplenews\SkipMailException
  2. 3.x src/SkipMailException.php \Drupal\simplenews\SkipMailException

Exception to throw when a mail should not be sent.

The Drupal mail system offers the $message['send'] flag which can be set to FALSE to mark that a message should not be sent. This is however typically considered a failure, and Simplenews handles it as an error (see \Drupal\simplenews\Mail\Mailer).

This exception can on the other hand be thrown in order to skip sending a message and have it considered as an expected result. It should only be thrown within the Drupal mail flow, for example within hook_mail() or hook_mail_alter().

Hierarchy

  • class \Drupal\simplenews\SkipMailException extends \Drupal\simplenews\RuntimeException

Expanded class hierarchy of SkipMailException

2 files declare their use of SkipMailException
Mailer.php in src/Mail/Mailer.php
simplenews_test.module in tests/modules/simplenews_test/simplenews_test.module
Hook implementations for the Simplenews Test module.

File

src/SkipMailException.php, line 18

Namespace

Drupal\simplenews
View source
class SkipMailException extends \RuntimeException {

}

Members