[development] How to run multiple email modules at the same time?

Earnie Boyd earnie at users.sourceforge.net
Wed Jun 22 19:20:48 UTC 2011


Ernst Plüss wrote:
> For our D7 websites we often have the need to run multiple email
> modules at the same time.
> 
> Let's make an example: We want to sent mime encoded emails, make sure
> every email gets logged and we want to send it using smtp.
> There are nice modules for this: http://drupal.org/project/mimemail,
> http://drupal.org/project/maillog and http://drupal.org/project/smtp.
> But there's a problem. All of them do register itself as the default
> mail system. This means only one of them can exist at the same time.
> There's no way of letting them coexist and do their job one after the
> other.
> 

I've always disliked this method or registration and for this very
issue.  Even the devel module can register a mail handler but that one
is to try to prevent mail from being sent during development cycles.

> The mail system variable allows to set different mail_systems for
> specific modules and/or keys. But that doesn't help. Even if we would
> take the work and set maillog as the mail system for all our email
> sending modules. How can we sent them via smtp after they have been
> logged?
> 

This of course has to do with actionable workflow where more than one
module needs to operate on an action in some specified order.  The hook
system helps but not perfect if we need hook a of module foo to execute
before hook b of module bar but hook a of module bar to execute before
hook b of module foo.  The module weighting system breaks the scenario.

> I think that the only solution is a central registry, similar to what
> hook_filter_info
> (http://api.drupal.org/api/drupal/modules--filter--filter.api.php/function/hook_filter_info/7),
> hook_node_info (http://api.drupal.org/api/drupal/modules--node--node.api.php/function/hook_node_info/7)
> or the wysiwyg module (http://drupal.org/project/wysiwyg) are doing
> for their particular need.
> 
> Therefore I've written a module providing the appropriate hooks. Since
> the idea is to wire together mail modules I called it mailwire
> (http://drupal.org/project/mailwire). I provided also integration
> patches for some mail modules.
> 

Sounds interesting.  I'll need to check out your module.

> Unfortunately I do not get a lot of feedback from the module
> maintainers. What would be the right approach to start a discussion
> and find a common solution? I think it would be big plus if Drupal
> would have an easy way to run any number of email formatting and
> sending modules in parallel.
> 

Conversation is started.  Again you're describing actionable workflow,
and something may already exist but I don't know yet.

-- 
Earnie
-- http://progw.com
-- http://www.for-my-kids.com


More information about the development mailing list