JBoss Community

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

created by valle in jBPM - View the full discussion

it's working! I've got a simple mail application running now and like you said, there shouldn't anything more block me from integrating this in more sophisticated workflows. thanks everybody :)

in case someone is facing a similar problem, this is the code snippet I used (in ProcessMain.java):

    

        // load up the knowledge base

        KnowledgeBase kbase = readKnowledgeBase();

        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

 

        EmailWorkItemHandler emailHandler = new EmailWorkItemHandler();

        emailHandler.setConnection("smtp.gmail.com", "587", "<username>@gmail.com", "<password>");

        emailHandler.getConnection().setStartTls(true);

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

 

        // start a new process instance

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

Reply to this message by going to Community

Start a new discussion in jBPM at Community