AnsweredAssumed Answered

Extension point for email sending?

Question asked by h.peter on Sep 3, 2012
Latest reply on Sep 3, 2012 by ronald.van.kuijk
Hi All,

Would it be possible to provide an extension point for email sending? At the moment the only way to intercept emails sent by Activiti is to monkey-patch org.activiti.engine.impl.bpmn.behavior.MailActivityBehavior class with my own code - I think it would be a useful feature to have something standard for this purpose.

Some background about this use case: To make testing easier, we we have implemented a simple email redirection logic in our code so that emails sent from development and QA environments are redirected to the person who started the process instance (the user's login name is stored as a process variable). This makes development and testing a lot easier: since our code stores the original to/cc/bcc addresses in the subject you can see where the workflow would have sent the emails to in the real world without flooding actual recipients with dozens of test emails.

Basically if the code in MailActivityBehavior could simply pass the constructed email instance to plugable component (where the default implementation simply invoked email.send() ), that would allow developers to perform arbitrary changes to the message before it is actually sent. 

What do you think?