Nguyen Ha
Nguyen Ha

Reputation: 47

How to config to send mail with activiti explorer?

I am using Activiti Explorer version 5.17, I want to send mail by using Mail Task but it not work. My config:

In engine.properties file (I can not found activiti.cfg.xml file):

engine.email.enabled=true
engine.email.host=myserver.com.vn
engine.email.port=25
engine.email.username=test
engine.email.password=test@123

My Mail Task

<serviceTask id="sid-024BFBEB-EC9D-475E-BE44-6E0996FFB64D" activiti:type="mail">
  <extensionElements>
    <activiti:field name="from" stringValue="[email protected]" />
    <activiti:field name="to" expression="[email protected]" />
    <activiti:field name="subject" expression="Your order  has been shipped" />
    <activiti:field name="html">
      <activiti:expression>
        <![CDATA[
          <html>
            <body>
              Hello ,<br/><br/>
              As of now, your order has been <b>processed and shipped</b>.<br/><br/>
              Kind regards,<br/>
              TheCompany.
            </body>
          </html>
        ]]>
      </activiti:expression>
    </activiti:field>
  </extensionElements>
</serviceTask>

When i run process, nothing is display in console, and it not work. Thanks for any help. :)

Upvotes: 2

Views: 2627

Answers (1)

Keylor Arosemena
Keylor Arosemena

Reputation: 11

I tried something but in the version 5.18(I'm not sure if can be applicable on your version), try to configure those thing on activiti-custom-context.xml(placed in activiti-explorer\WEB-INF\classes). Also you can configure your db connection, for example. First uncomment the beans and then fill your db information in the bean with the id "dataSource".

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName" value="com.mysql.jdbc.Driver" />
    <property name="url" value="jdbc:mysql://localhost:3306/database" />
    <property name="username" value="user" />
    <property name="password" value="password" />
    <property name="defaultAutoCommit" value="false" />
  </bean>

To configure the email add some properties to the bean with the id "processEngineConfiguration"

 <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
    <property name="dataSource" ref="dataSource" />
    <property name="transactionManager" ref="transactionManager" />
    <property name="databaseSchemaUpdate" value="true" />
    <property name="jobExecutorActivate" value="true" />
    <property name="enableDatabaseEventLogging" value="true" />
    <property name="customFormTypes">
      <list>
        <bean class="org.activiti.explorer.form.UserFormType"/>
        <bean class="org.activiti.explorer.form.ProcessDefinitionFormType"/> 
        <bean class="org.activiti.explorer.form.MonthFormType"/>   
      </list>
    </property>
    <property name="mailServerUseTLS" value="true" /><!--This is important if you use Gmail as your hoster -->
    <property name="mailServerHost" value="smtp.gmail.com" />
    <property name="mailServerPort" value="587" />
    <property name="mailServerUsername" value="[email protected]" />
    <property name="mailServerPassword" value="hostpassword"/>
  </bean>

Upvotes: 1

Related Questions