you can copy that, and it will work.
Remember that WorkItems are domain specific and the main idea is that you can plug your own. So if you copy that handler it should work. Of course you will need a mail server running and configure the environment correctly.
do I need to define it also in any conf file? or just register it as:
ksession.getWorkItemManager().registerWorkItemHandler("EMail", new EmailWorkItemHandler(ksession));
If you register it, it will work. If you want to see the custom work item in the palete you must create the conf file.
Remember that you must also have a node binded to "EMail" in your processes in order that the EmailWorkItemHandler will be executed.
By the way, why are you passing the ksession as a parameter?
It was a mistake to send the kession. in the end I used:
EmailWorkItemHandler handler = new EmailWorkItemHandler();
handler.setConnection( "mail.smtp.host", "myemailPort", null, null );
Great, if you get it working, can you mark this question as answered?