The rules that ship with mimemail are manually calling the mimemail() function. They are using drupal_mail to format the messages but not using it to send the mail. I'm unsure why drupal_mail is used to format but not send. This is bad because it by-passes all the mail settings particularly the 'smtp_library' variable which is used by devel module to capture mail and log it for dev environments. Because it's sending mail directly, emails can be sent by mistake regardless of settings :(
I've included a patch that simply uses drupal_mail to send the messages from the rule actions.
| Comment | File | Size | Author |
|---|---|---|---|
| mimemail-rules-manual-send.patch | 1.85 KB | smithmilner |
Comments
Comment #1
sgabe commentedWith your patch sending HTML mail would be possible only if the "Use for all site messages" option is set, this is why mimemail() is called manually. However we could check this option and skip the mimemail() call in that case.
Comment #2
smithmilner commentedAh I see, while that makes sense I think as it is it's a bit hazardous.
Would it be reasonable for this kind of check to be in place? I don't know what your policy is with integrating with other modules.
Comment #3
sgabe commentedIf you are interested in this because of the Devel module, note that the calling drupal_mail() then mimemail() is the preffered way of sending HTML messages. Since probably there are a lot of implementations doing this, there is no point in changing this: messages still can be sent by mistake regardless of settings...
I think this is a duplicate of #1205682: Unilaterally Disable Mimemail in Development Environment which I suppose is your original goal here.
Comment #4
smithmilner commentedYou're right, if we are to implement a safe guard. It should once the call to mimemail() has been made.
Ok, moving my replies over to that ticket.