Activiti Mail Task

12月 22, 2015 |

1、在流程定义中添加一个代表邮件任务的ServiceTask

<serviceTask id="mailtask1" name="Mail Task" activiti:type="mail">
<extensionElements>
<activiti:field name="to">
<activiti:string><![CDATA[接受者邮箱]]></activiti:string>
</activiti:field>
<activiti:field name="from">
<activiti:string><![CDATA[发送者邮箱]]></activiti:string>
</activiti:field>
<activiti:field name="subject">
<activiti:string><![CDATA[主题]]></activiti:string>
</activiti:field>
<activiti:field name="cc">
<activiti:string><![CDATA[抄送人]]></activiti:string>
</activiti:field>
<activiti:field name="html">
<activiti:expression><![CDATA[
邮件内容
]]></activiti:expression>
</activiti:field>
</extensionElements>
</serviceTask>

注意需要将<![CDATA[]]>中的内容换成实际的信息。当然这些信息可以再Activiti的Properties view中可视化配置

2、processEngineConfiguration中添加邮箱服务器相关的信息

<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
<.....>
<property name="mailServerHost" value="smtp.126.com" />
<property name="mailServerUsername" value="邮箱用户名" />
<property name="mailServerPassword" value="邮箱密码" />
</bean>

serviceTask中配置的是发送者是用户显示的,processEngineConfiguration中配置的才是用于认证的。

Posted in: Activiti

Comments are closed.