Hello,

On our staging server, we use Devel module's "SMTP Library:" option, which lets you choose "Default" or "Log Only." It's set to only Log on the staging site so our users don't receive erroneous or duplicate emails. This does not seem to stop Mimemail from going out - at least Mimemail's rules implementation. Is this by design or an accident? Mimemail is the only module I know of that ignores this directive.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sgabe’s picture

Status: Active » Closed (works as designed)

This is by design.

Mime Mail can send a message by itself after just preparing it with drupal_mail(). The Devel module defines drupal_mail_wrapper() when you set "Log Only", but that won't catch messages sent by Mime Mail, just the system messages which are sent with drupal_mail() by default and only processed by Mime Mail if it's set to be used for all messages.

Offlein’s picture

Title: Mimemail Rules not overriden by Devel's SMTP Library? » Unilaterally Disable Mimemail in Development Environment
Status: Closed (works as designed) » Active

sgabe, sorry, I wish I'd replied to this long ago. I don't know why I didn't. Sorry to rudely reopen this ticket after so long.

My main point is that I'm curious if there's an existing way to disable Mimemail unilaterally somehow, preferably by a Drupal variable. I need to have a staging server that is an exact duplicate of our production environment except for a few features. For instance, it can't be sending automated emails to people, and it can't be automatically charging users' credit cards (something we do for recurring billing).

In the past, as I said, I have simply set the staging environment's settings.php up with a hardcoded variable setting the Drupal "SMTP library" option to use Devel's "Log Only", but as you confirmed, that won't work with Mimemail.

So, is there a variable I could hardcode in my staging settings.php to effectively disable any Mimemail emailings? I notice there is a "mimemail_engine" variable - perhaps I could change that?

smithmilner’s picture

Category: support » feature
Status: Active » Needs review
FileSize
708 bytes

marked http://drupal.org/node/1637766#comment-6134064 as a duplicate of this ticket.

There is no disable option for mimemail that I can see but it is certainly needed. Let's see if we can add a safeguard here. I've included a small patch that allows developers to create a variable to disable mimemail or disable mimemail if the smtp_library is set to devel.

smithmilner’s picture

My mistake, previous patch still sends messages if either the disable variable or the smtp_library are approved. If should stop messages if either is denied.

sgabe’s picture

Status: Needs review » Needs work

Your patch will send the message when mimemail() is called not to send but to prepare with the $send = FALSE parameter and none of the conditions met.

Is a new variable for this really necessary? Devel is a very popular module and it has this functionality, Mime Mail should just simply respect it.

smithmilner’s picture

No a new variable isn't necessary, we can exclude it. Perhaps we should look at a way of logging the emails to watchdog when devel is configured as the smtp_library. That's what it does with other emails and people might get confused that Mime Mail might not be working.

aidanlis’s picture

I'd really like this to be included! Logging would be very helpful.

sgabe’s picture

Component: Miscellaneous » Code
Status: Needs work » Needs review
FileSize
1.43 KB

I am attaching a patch with logging, though I am not sure about the way. Since we are talking about MIME encoded messages with possible attachments and embedded images it does not seem to be a good idea to log the message body.

TR’s picture

Version: 6.x-1.x-dev » 8.x-1.x-dev
Issue summary: View changes
Status: Needs review » Needs work

New features should go into the current version of Mime Mail. If this feature is important to you please contribute a patch, a test, or provide support in other ways.

TR’s picture

Status: Needs work » Closed (won't fix)

The use case described in #2 can be handled in many ways. See https://www.drupal.org/docs/develop/local-server-setup/managing-mail-han...

Mime Mail should not be implementing features that are better handled by other contributed modules. Mime Mail only does formatting of emails. Delivery (or non-delivery, or logging, etc.) of emails should be be left to other modules as described above.