cancel
Showing results for 
Search instead for 
Did you mean: 

Extension point for email sending?

h_peter
Champ in-the-making
Champ in-the-making
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?

Thanks
Peter
1 REPLY 1

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
You can also just use your own service task and not use the mail task that comes with activiti. That is in my opinion easier and cleaner than patching the class tat comes with activiti.