It learned me that in case of specifying a custom mail producer a mail template is not set.org.jbpm.jpdl.internal.xml.JpdlParser:

To solve this error adjust the constructor of the mail producer by adding the following code:

At the end this is how my Mail producer looks like (it is still extended from the default mail producer but at this point just implementing the interface would probably do the trick)

Last thing I want to mention is the override of the produce method. In that method I retrieve the current task from the TaskContext. This opens the possibility to use it in the other methods of the class . (Below also a code snippet from the org.jbpm.jpdl.internal.activity.MailListener which is responsible for maintaining the TaskContext).