Search code examples
javajbpm

configure workitemhandler to send email in JBPM 7


below is the work item handler currently we have to send email in JBPM 7.32.

But we are getting error java.lang.RuntimeException: Unable to send email".

new org.jbpm.process.workitem.email.EmailWorkItemHandler("smtp.gmail.com", "465", 
                                                       "ax@gmail.com", "x@gmail.com",true)

Could you please help.

Below is the sample workflow we have , to just send an email.

enter image description here

below is the settings where we have this e-mail work item handler.

enter image description here


Solution

    1. Delete the Email task from your BPMN web Design (process graphic)
    2. Delete the Email from Work Item Handlers
    3. go to Settings/Service Tasks and Install Email (if it is installed, unistall it and click on install)
    4. fill the form with required parameters:
      host : smtp server host name
      port : smtp server port number
      username : account to be used when login to SMTP server (the email address)
      password : account's password to be used when login to SMTP server
    5. if you provide all this informations, the Work Item Handler will be generated automatically ( you can check it in Settings/Deployments/ work Item Handlers), DON'T EDIT IT !
    6. Go back to your Process, and insert again the email task as in the following screen shot enter image description here
    7. Select your Email task, go to the Diagram properties (on the right), and click on Assignments. enter image description here
    8. You can now assign global variables or constants to each attribute (Body,From,Subject,To)
      From : valid email address
      To : valid email address of the recipients (to specify multiple addresses separate them with semicolon ';')
      Subject : email subject
      Body : email body (can include html)