In Drupal 7 core the consequence is:

  • Run all hook_mail_alter() implementations
  • Run MailSystemInterface::format() function of default mail system class

You can see it in code of drupal_mail().

But in Mail System module for Drupal 6 this consequence may be broken, because it uses hook_mail_alter() to run MailSystemInterface::format() function and doesn't change default zero weight. So, any module implementing hook_mail_alter() with weight larger than zero (or even modules installed after Mail System with zero weight) will possibly break message formatting.

I'd like to write patch which increases weight up to 9999 or even more to guarantee mailsystem_mail_alter() will be the latest in chain, but I need maintainer's opinion about it. What do you think?

Comments

dmitriy.trt’s picture

Status: Active » Needs review
StatusFileSize
new1.47 KB

Anyway, we've implemented it for our site, so here it is. Based on version 6.x-2.28

pillarsdotnet’s picture

The way to guarantee "last in chain" is to write a hook_requirements() implementation that runs a database query and to find the largest weight (other than mailsystem's) and adjust mailsystem's weight to that number plus one.

But my preferred solution is to write a module to let the developer adjust weights. (Actually, such a module exists, but it's in a mix-and-match group of other addons, rather than stand-alone.)

pillarsdotnet’s picture

Assigned: Unassigned » pillarsdotnet
StatusFileSize
new3.05 KB

This is probably the route I'm going to take for now.

pillarsdotnet’s picture

Version: 6.x-2.28 » 6.x-2.30
Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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