Sending emails using MailActivityBehavior

Hello,

I am working on an approval workflow, an as expected in such cases, I need to notify approvers via emails. I decided to choose MailActivityBehavior as it supports field expressions and I can easily use Velocity in order to generate email body.
My problem is caused by the fact that in case something goes wrong while sending the email(mail server is down), the process is not moving forward to the next wait state. I have tried to use error boundary event on the ‘mail’ send task, but it seems that it is ignored(from the implementation I saw that the error propagation is not used and in case something goes wrong while sending the email, a RuntimeException is thrown).
So what I need to know is if there is a simple way I can fix this problem, or do I have to look for other solutions, like task listener or maybe a mail plugin.

I am using camunda-bpm-platform-7.4.0.

Thanks,
Bogdan Tatar

Hi Bogdan,

you found a current limitation of the mail behavior. As a workaround, you can override the behavior with a custom one. For example, you can write a BpmnParseListener and replace the MailActivityBehavior by your own behavior which may extend the existing one.

If you found a good solution and want to share it with the community then you can create a pull request or provide a small community extension for sending mails (which may be the better choice).

Greetings,
Philipp

Hi Philipp,

Thanks a lot for you suggestions. What I did in the end was the write a custom plugin which is registering a custom BpmnParseListener(as you said) and it works fine.
I don’t know if this is a good solution, but if more info are needed I will gladly share them.

Best regards,
Bogdan Tatar