cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with Activiti Mail Task

markushbm
Champ in-the-making
Champ in-the-making
Hi,

I tried to implement a basic mailing process which just generates an email and sends it to a specific address. Basically, Iit is based on the mail example from the userguide.

I have got some German chars (äöüß) in the text but after the email has been sent and arrives in my mailbox, the umlauts are replaced with garbage. the bpmn20.xml is encoded in utf-8 with the proper xml encoding value in the file. Any suggestions?

EDIT: When I manually set my mailclient to ISO-8859-15 the mail looks fine. But the mail headers say that the mail is encoded in utf-8. Is there something wrong with mail handling?

This somehow leads to my other issue. Every time after I have edited the bpmn20.xml file I wanted to redeploy my process. So, I went to Probe - Deployments, deleted my process.bar and reployed my process with an ant target. I can now select my process in Explorer, but it is still an old version of the process (e.g. changing the from address in my email task and redeploying still gives me the old from address)

I hope someone is able to support me. 🙂 If you have any other suggestions like "Hey, it's much easier to deploy processes with…" please don't hesitate to answer this post.

Regards,
Markus
11 REPLIES 11

frederikherema1
Star Contributor
Star Contributor
1) About the email, are you using a HTML-mail? If so, these characters should be escaped (eg. ë  -> &eumlSmiley Wink. You can find a lot of libraries that can do this for you, or FCK-editors (if the text comes from webpage).

2) In probe, can you check the tab "database" and see what's inside ACT_RE_PROCDEF table. Do you see the new version of the process in there?

jcosano
Champ in-the-making
Champ in-the-making
I solve this modifying MailActivityBehavior.class

  protected HtmlEmail createHtmlEmail(String text, String html) {
    HtmlEmail email = new HtmlEmail();
    try {
      email.setCharset("ISO-8859-15");
      email.setHtmlMsg(html);
      if (text != null) { // for email clients that don't support html
        email.setTextMsg(text);
      }
      return email;
    } catch (EmailException e) {
      throw new ActivitiException("Could not create HTML email", e);
    }
  }

frederik solution 1: is not valid for variables (aren't escaped).

frederikherema1
Star Contributor
Star Contributor
jcosano,

Good point about the variables not being escaped when mail is sent as HTML! Can you create an issue in JIRA for this?

jcosano
Champ in-the-making
Champ in-the-making

markushbm
Champ in-the-making
Champ in-the-making
2) In probe, can you check the tab "database" and see what's inside ACT_RE_PROCDEF table. Do you see the new version of the process in there?

Yes, after deleting the previous deployment and redeploying a new one is added with a different deployment id. But the behaviour is still the same. I tried to change a word in my email task but it does not work.

Markus

EDIT: When redeploying without deleting the old deployment in first place a new process is created with version number 2. Starting this process works fine and all changes are shown. But after deleting the deployments and adding a new one the original process (which should not be there anymore) is still started. Any help?

EDIT2: This really starts to annoy me. Is there something like a cache? I had around 15 mailtest.bar deployed just to test different features. After deleting them in Probe und redeploying (using Ant) the engine really uses the first version of the process, which should NOT exist anymore, because there were ~15 different versions after that. I now have to deploy my bar about 16 times in order to get the new results. So could someone please tell me whether I am doing something wrong or if this is just a bug?

EDIT3: This seems to be a bug or misusage in/of Ant deploying. When uploaded via Probe the process works fine. Please find my Ant build.xml here -> http://pastebin.com/NA1MH6RV

jbarrez
Star Contributor
Star Contributor
Your ant xml looks OK on first sight.

How do you start your process instance?
There is a cache of process definitions internally, but it always checks if it is using the latest version.
You keep the same process key every time ?

markushbm
Champ in-the-making
Champ in-the-making
With process key you mean the process id, e.g. vacationRequest which will be vacationRequest:1 if called via REST API?

I'm starting processes directly from Activiti Explorer and/or the REST API. I need to reconfigure an already deployed very often, because I am developing it step by step. So, to change a typo in a form, I delete the deployment (is there an Ant way to do this instead of going to Activiti Probe and deleting the .bar?) und redeploy the new bar to Activiti. With Ant only new versions of the process (e.g. vacationRequest:5, do I have to explicitly call it in my REST client or is vacationRequest enough?) will work.

jbarrez
Star Contributor
Star Contributor
If you are developing it step by step, it is definitely advisable to test your processes using unit tests. This is way will be much more quicker, and you will gain the confidence that the process doesnt break later on.

I verified the REST API, and indeed you need to provide the id, not the key alone.
I'll ping the REST developer that this definitely would be nice to have.

Regarding to your problem: I cannot realky reproduce it: i can keep deploying, and when I click the new version in Explorer; it starts up correctly.
Can you describe anything you are doing besides that?

jbarrez
Star Contributor
Star Contributor
Markus, I've been able to reproduce your problem, and checking why it is happening.