cancel
Showing results for 
Search instead for 
Did you mean: 

E-mail Configuration

geetha
Champ in-the-making
Champ in-the-making
Hi all,

I am new to Activiti BPM, I am trying to customize the source code and making changes to that, right now i made few changes like logo etc. in activiti-webapp-explorer2 project and deployed war file in Tomcat and got the output as according to changes. But now i am trying to configure the e-mail server to point to g-mail server by adding below configuration in activiti-webapp-explorer2\src\main\resources\activiti-custom-context.xml and build, re-deployed in tomcat.

<property name="mailServerHost" value="smtp.gmail.com" />
           <property name="mailServerPort" value="587" />
           <property name="mailServerUseSSL" value="false" />
           <property name="mailServerUseTLS" value="true" />
           <property name="mailServerDefaultFrom" value="xyz@gmail.com" />
           <property name="mailServerUsername" value="xyz@gmail.com" />
           <property name="mailServerPassword" value="xyz123" />

When i am trying to execute laptopOrdering-HumanProcess workflow given in activiti pdf, the e-mail task is failing and giving below error. Please let me know where do we need to put this configuration in the source code.

Caused by: org.apache.commons.mail.EmailException: Sending the email to the following server failed : localhost:25
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1401)
at org.apache.commons.mail.Email.send(Email.java:1428)
at org.activiti.engine.impl.bpmn.behavior.MailActivityBehavior.execute(MailActivityBehavior.java:66)
… 75 more
Caused by: javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;
nested exception is:
java.net.ConnectException: Connection refused: connect
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1391)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370)
at javax.mail.Service.connect(Service.java:275)
at javax.mail.Service.connect(Service.java:156)
at javax.mail.Service.connect(Service.java:105)
at javax.mail.Transport.send0(Transport.java:168)
at javax.mail.Transport.send(Transport.java:98)
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1391)
… 77 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)

Below version used:
Activiti Version: 5.17.0
Tomact 7
JDK 8

Thanks,
Geetha
      

19 REPLIES 19

vasile_dirla
Star Contributor
Star Contributor
you could have a look over this area of the documentation: (http://www.activiti.org/userguide)
8.5.6. Email Task (Mail server configuration)

geetha
Champ in-the-making
Champ in-the-making
Hi vasile.dirla,

I want to point mailServerHost to external server  "smtp.gmail.com" insted of localhost. The default is taking as localhost.

<property name="mailServerHost" value="smtp.gmail.com" />

this Configuration part which config i need to put and also which project and file in source code.


jbarrez
Star Contributor
Star Contributor
Sure, then you simply set the mailServerHost to that url. Isn't that working?

geetha
Champ in-the-making
Champ in-the-making
Hi jbarrez,

Yes, I set the mailServerHost to smtp.gmail.com but not working facing same error.  I am novice to activiti, could you please let know where i need to add this code in source code of project Activiti to configure mail.

<bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration">
  <property name="mailServerHost" value="smtp.gmail.com" />
           <property name="mailServerPort" value="587" />
           <property name="mailServerUseSSL" value="false" />
           <property name="mailServerUseTLS" value="true" />
           <property name="mailServerDefaultFrom" value="abc@gmail.com" />
           <property name="mailServerUsername" value="abc@gmail.com" />
           <property name="mailServerPassword" value="abc001" />
          </bean>
</beans>

Thanks
Geetha

ssgopi
Champ in-the-making
Champ in-the-making
Hi Geetha,

You need to add this on activiti-custom-context.xml file.

Regards
Gopi

geetha
Champ in-the-making
Champ in-the-making
Hi Gopi,

Thankyou, I added the above code on activiti-custom-context.xml ( file which is in activiti-webapp-explorer2 folder). But getting same error as I mentioned above, could you please let me know if anything else do i need to add or set up anything.  In explorer i am getting this error: Warning! Could not send e-mail in execution 9030
Please guide me on this.


Thanks,
Geetha

ssgopi
Champ in-the-making
Champ in-the-making
Hi,
Just to clarify. Post making the changes. Did you restart tomcat?. I have the same entry as you  on the activiti-custom-context.xml file,
It works for me.
Regards
Gopi

shil-srini
Champ in-the-making
Champ in-the-making
Hi Gopi,

Could you please explain What changes u did to get the Mail task working as its still taking the default localhost and port 25 for the mail task and giving the error. It would be of great help.

Thanks.

geetha
Champ in-the-making
Champ in-the-making
Hi,

Yes, I restarted tomcat and checked, getting same error.

Regards,
Geetha