You are here

function hook_simplenews_mail_result_alter in Simplenews 3.x

Same name and namespace in other branches
  1. 8.2 simplenews.api.php \hook_simplenews_mail_result_alter()

Invoked after sending of every mail to allow altering of the result.

A common use of this hook is categorise errors and distinguish a global failure from an error that is specific to a single recipient.

Parameters

int $result: One of the SpoolStorageInterface::STATUS_* constants.

array $message: The message returned by \Drupal\Core\Mail\MailManagerInterface::mail().

1 function implements hook_simplenews_mail_result_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

simplenews_test_simplenews_mail_result_alter in tests/modules/simplenews_test/simplenews_test.module
Implements hook_simplenews_mail_result_alter().
1 invocation of hook_simplenews_mail_result_alter()
Mailer::sendMail in src/Mail/Mailer.php
Send a node to an email address.

File

./simplenews.api.php, line 242
Hooks provided by the Simplenews module.

Code

function hook_simplenews_mail_result_alter(&$result, array $message) {
  if (specific_error()) {
    $result = SpoolStorageInterface::STATUS_FAILED;
  }
  if (global_error()) {
    throw new AbortSendingException('Mail transport error');
  }
}