I have a module that uses mailsystem. My
hook_enable() looks like this:
mailsystem_set( array( 'my_module_name' => array( 'format' => 'TheMailSystemName', ), ) );
When I first enable that module, mailsystem cleverly creates a new wrapper class called
TheMailSystemName__DefaultMailSystemName.mail.inc in order to use
format() method, but
mail() method. Pretty awesome so far.
I also have this code in my
hook_disable() for my module:
mailsystem_clear( array( 'my_module_name' => array( 'format' => 'TheMailSystemName', ), ) );
If I disable my module, and I re-enable it. I get a sad "
The website encountered an unexpected error. Please try again later." message. Even though there is that message, the module does enable successfully, but the
mail_system variable that this module is working with does not get setup correctly. When I go to
/admin/config/system/mailsystem I do not see my module associated with the newly-written
TheMailSystemName__DefaultMailSystemName class, and I have to set it up via the GUI in there.
What am I doing wrong?