Create hook to allow other modules to respond to sent mails (both successful or failed)

Created on 11 December 2013, over 10 years ago
Updated 28 September 2023, 9 months ago

The queue worker function triggers the corresponding queue_mail_send drupal_alter() function before sending, as expected.

However, a queue_mail_sent hook triggered via the module_invoke_all() would be very helpful to allow further actions and processing to happen after successfully sent mails (increment counters, send statistics, sent items' archival, etc).
At least, with successfuly sent emails. As an added bonus, both success/failure cases could be covered via corresponding queue_mail_sent_success and queue_mail_sent_failed or such.

Anyway, not just restricting the hook's use case to catch failed items, but opening it to both success and failed to enable other possible usages scenarios to contrib modules.

Original post

Would like to be able to react to a failure of the send from the queue. Currently, a mail send failure is logged, but the item is deleted from the queue. Adding something like:

      // Allow other modules to react to the send failure.
      module_invoke_all('queue_mail_send_failure', $message);

after the log entry in the queue_mail_send() function would permit this.

Or if someone has a better idea of how to enable this, please feel free to let rip!

✨ Feature request
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom thurulingas

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024