Alejandro Guizar [
http://community.jboss.org/people/alex.guizar%40jboss.com] replied to
the discussion
"Mail template for custom MailProducer"
To view the discussion, visit:
http://community.jboss.org/message/538607#538607
--------------------------------------------------------------
Here is how you can specify a named template for a custom mail producer:
<mail name='send mail' class='org.example.CustomMailProducer'>
<field name='templateName'><string
value='rectify-template'/></field>
<transition to='end' />
</mail>
Here is the custom mail producer code:
public class CustomMailProducer extends MailProducerImpl {
private String templateName;
public Collection<Message> produce(Execution execution) {
MailTemplateRegistry templateRegistry = EnvironmentImpl
.getFromCurrent(MailTemplateRegistry.class);
setTemplate(templateRegistry.getTemplate(templateName));
return super.produce(execution);
}
}
It should be possible to inject a reference to the template registry into the bean, but it
is not currently possible due to the way the custom mail producer is parsed. I will fix
this in
https://jira.jboss.org/jira/browse/JBPM-2844 JBPM-2844.
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/538607#538607]
Start a new discussion in jBPM Development at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]