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
Comment #1
dmitriy.trt commentedAnyway, we've implemented it for our site, so here it is. Based on version 6.x-2.28
Comment #2
pillarsdotnet commentedThe 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.)
Comment #3
pillarsdotnet commentedThis is probably the route I'm going to take for now.
Comment #5
pillarsdotnet commentedFixed in 6.x-2.30 release.