JBoss Community

Re: How to use Email service in JBPM 5.x?

created by Rajan Vij in jBPM - View the full discussion

It is simple all you need to have a valid SMTP available.

 

Rest add following code to your process java file.

 

startUp(); 

KnowledgeBase kbase = readKnowledgeBase();

StatefulKnowledgeSession ksession = JBPMHelper.newStatefulKnowledgeSession(kbase);

EmailWorkItemHandler emailHandler1 = new EmailWorkItemHandler();

emailHandler1.setConnection("smtp.gmail.com","587", "uremailId", "password");

emailHandler1.getConnection().setStartTls(true);

ksession.getWorkItemManager().registerWorkItemHandler("Email",emailHandler1);

ksession.startProcess("com.sample.bpmn.hello");

System.out.println("Process started ...");

Reply to this message by going to Community

Start a new discussion in jBPM at Community