drupal_mail_send() checks the smtp_library variable, and if that file exists, it is loaded and used instead of drupal's default mail handling routines. Contrib modules are expected to set this variable to their own library if they provide one.
The problem is trusting contrib modules to properly remove this variable when disabled or uninstalled. If they don't, Drupal will silently continue to use a disabled module's mail handling routines, this is bad. This effect can only be removed by completely deleting the problem module out of your codebase (so the include file doesn't exist anymore, and Drupal will revert to default mail routines).
drupal_mail_send() should check to make sure they module that owns the include file is also enabled before inclusion. If the module is disabled, use the default mail routines.
This bug is well documented and remains unfixed in Mimemail module #456260: WSOD: smtp_library variable is not removed when mimemail has been disabled, but it would be good to have a safety check against all misbehaving contrib modules.
Comments
Comment #1
kscheirerfixed title - preview button seems to have reset it?
Comment #2
ChrisRut commented:subscribe:
Comment #3
kenorb commented+1
Comment #4
mitchmac commentedI don't know how we could determine which module has set the variable. Parsing the variable to determine the module name from the filepath only works if
drupal_mail_wrapperis defined in the module's own directory structure (wouldn't be the case if referencing an outside library or a module dependency). Adding a new variable or alteringsmtp_libraryto keep track of the enabling module would still require proper module implementation right?Maybe inspect the return from
drupal_mail_wrapper? That's tough though because we don't know what to expect and I suspect some of the mail rerouting/altering modules may do some of their magic with this function.Comment #5
kenorb commentedMail system has been rewritten in Drupal 7, so marking as fixed in D7 as `smtp_library` doesn't exist anymore.