AnsweredAssumed Answered

mail task: mail not send but no errors either

Question asked by michafn on Sep 5, 2012
Latest reply on Sep 26, 2012 by jbarrez
hello,

I am just getting started with activit and BPMN 2.0, and therefore tried to setup a really simple process, which does nothing but sending an email via an external SMTP server.

This is my process definition:

<process id="process1" name="process1">
    <startEvent id="startevent1" name="Start"></startEvent>
    <endEvent id="endevent1" name="End"></endEvent>
    <serviceTask id="mailtask1" name="Mail Task" activiti:async="true" activiti:type="mail">
      <extensionElements>
        <activiti:field name="to" expression="my@mailadress"></activiti:field>
        <activiti:field name="subject" expression="test"></activiti:field>
        <activiti:field name="html">
          <activiti:expression><![CDATA[retretret]]></activiti:expression>
        </activiti:field>
        <activiti:field name="text">
          <activiti:expression><![CDATA[retretret]]></activiti:expression>
        </activiti:field>
      </extensionElements>
    </serviceTask>
    <sequenceFlow id="flow1" name="" sourceRef="startevent1" targetRef="mailtask1"></sequenceFlow>
    <sequenceFlow id="flow2" name="" sourceRef="mailtask1" targetRef="endevent1"></sequenceFlow>
  </process>

In the activiti.cfg.xml file I added following paramters

<property name="mailServerHost" value="xxx" />
       <property name="mailServerUsername" value="xxx" />
       <property name="mailServerPassword" value="xxx" />

and finally generated a simple test unit to start the process:

RepositoryService repositoryService = activitiRule.getRepositoryService();
      repositoryService.createDeployment().addInputStream("process1.bpmn20.xml",
            new FileInputStream(filename)).deploy();
      
      RuntimeService runtimeService = activitiRule.getRuntimeService();
      Map<String, Object> variableMap = new HashMap<String, Object>();
      variableMap.put("name", "Activiti");
      ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process1", variableMap);
      assertNotNull(processInstance.getId());
      System.out.println("id " + processInstance.getId() + " "
            + processInstance.getProcessDefinitionId());

so everything pretty much standard operations…
However, if i start the process it looks all fine, I get the expected output from the last line of the code and no error message…but I do not receive any email as well and since I do not get any error I cannot even debug…

did anyone experience a similar problem? Am I missing anything fundamental?

Thanks for any help…

Outcomes