smtp_library variable is not removed when mimemail has been disabled

kenorb - May 7, 2009 - 12:53
Project:Mime Mail
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review
Description

smtp_library is still set to mimemail.module path after uninstalling mimemail module.
So even mimemail module is disabled, all mails are send via mimemail causing conflict with other modules (htmlmail).

Related issues:
#236495: missing mimemail_uninstall() to remove all variables
#362531: sent emails are empty after changed from Mimemail

Solution:
In hook_uninstall there should be additional code similar to this one:

<?php
   
if (strpos(variable_get('smtp_library', ''), 'mimemail') !== FALSE) {
     
variable_del('smtp_library');
    }
?>

#2

kenorb - May 7, 2009 - 13:32
AttachmentSize
mimemail.install.patch 314 bytes

#3

asak - May 9, 2009 - 12:06

Bless you kenorb. Really.

#4

kscheirer - July 11, 2009 - 00:34
Status:active» needs work

Wow, just got bit hard by this bug, spent more time than I care to admit tracking this down!

It's actually worse than you think kenorb. There's also the case that the user had mimemail enabled (so smtp_library is set to mimemail), and then disables but does not uninstall mimemail. The variable still points to mimemail, and drupal (in mail.inc::drupal_mail_send()) just checks the smtp_library variable and to make sure the include file exists - it never checks to make sure the module is enabled.

So yeah, the upshot is, to remove the effects of this module, delete it. Or with kenorb's patch above completely uninstall it! Just disabling the module does not clean up enough.

#5

kenorb - July 11, 2009 - 12:24

So in this case this code:

<?php
 
if (strpos(variable_get('smtp_library', ''), 'mimemail') !== FALSE) {
   
variable_del('smtp_library');
  }
?>

should be as well copied into hook_disable()

#6

kenorb - July 11, 2009 - 12:25
Title:smtp_library variable is not removed when mimemail has been uninstalled» smtp_library variable is not removed when mimemail has been disabled

#7

kenorb - October 19, 2009 - 19:50
Status:needs work» needs review
 
 

Drupal is a registered trademark of Dries Buytaert.