Remove hook_mail_post_process()

Created on 18 February 2023, over 1 year ago
Updated 13 March 2023, over 1 year ago

In D7 and prior versions, Mime Mail module defined a hook_mail_post_process(), but I haven't been involved with this project long enough to know the historical reasons of why it was introduced and what it was intended for. Likewise, there's no API documentation about this, even though it's been in Mime Mail for a very long time.

This hook is not currently called, and is commented out in MimeMail.php.

The question here is, is this useful? If so, we should define the use cases, the hook should be documented in mimemail.api.php and the code should be uncommented and a test should be written for it.

If it's not useful to anyone, then it should be removed for good.

πŸ“Œ Task
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States tr Cascadia

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

Comments & Activities

  • Issue created by @tr
  • πŸ‡ΊπŸ‡ΈUnited States tr Cascadia

    Further information:

    This hook was added to mimemail 7.x-1.x on 23 Feb 2009 by commit de2aa7fa438ed073da55

    There is no issue associated with this commit, so there is no text or documentation to tell us what the intent was. But the commit message is:

    - Modifications to mimemail_compress
    - added hook_mail_post_process() to mimemail api allowing for message processing after templating has been preformed in mimemail_prepare().

    An examination of this shows that hook_mail_post_process() was added solely for the benefit of the mimemail_compress submodule.

    mimemail_compress is a fork of parts of Emogrifier, but it was removed in the Drupal 8 version of mimemail by πŸ“Œ Port mimemail_compress module to D8 Closed: won't fix

    A search of the Drupal repository (https://git.drupalcode.org/search?group_id=2&repository_ref=9.5.x&scope=...) shows that this hook is not used by any module other than mimemail_compress.

    If we need to recover the functionality of mimemail_compress at some point we can just use the pelago/emogrifier package or the drupal.org/project/emogrifier module - there is no need to write our own version.

  • Status changed to Needs review over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States tr Cascadia

    hook_mail_post_process() has never worked in Drupal 8+, as it has been commented out since the original port of this module to Drupal 8 back in 2015. See #2138947: Drupal 8 version β†’

    Because of that, and because there have been no requests in the issue queue to restore this hook, and because no one has opened and issue or offered a patch, I conclude that there is no significant desire from the community to support this feature going forward.

    Here's a patch that removes the commented-out code.

  • Status changed to RTBC over 1 year ago
  • πŸ‡΅πŸ‡­Philippines paraderojether

    @ TR

    Applied patch #3 against Mime Mail version 8.x-1.x-dev with Drupal Core version 9.5.3, and the patch successfully removed the commented-out code.

    Thank You.

    • TR β†’ committed c38a6822 on 8.x-1.x
      Issue #3342914 by TR: Remove hook_mail_post_process()
      
  • Status changed to Fixed over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States tr Cascadia

    Committed.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024