confused about app.properties

Hello, I’m trying to use the email functionality but I’m confused about where to store the email properties. In the documentation, it states that they could be stored in any app.properties.
I created my properties in the app.properties located in /modules/core/src but the application didn’t like it. i received the following error: Caused by: com.haulmont.cuba.core.global.RemoteException:org.activiti.engine.ActivitiException: Could not send e-mail in execution 5038
—org.apache.commons.mail.EmailException: Sending the email to the following server failed : localhost:25
—com.sun.mail.util.MailConnectException: Couldn’t connect to host, port: localhost, 25; timeout -1
—java.net.ConnectException: Connection refused: connect

I’m trying to send email from a BPM Email Task.

The larger question is, it’s okay for development to store those properties in the app.properties, but if i’m going to install the app at multiple clients, I would need an easy way to configure the email properties.
in fact, what would be great is a screen within the Administration menu, where we can add/edit those properties.
Thanks.

The problem is that activiti Email task doesn’t use cuba emailer for sending emails. We will do something about that in future releases. Now I suggest you to use not Email task but a regular Service task like the one that sets contract state in BPM quickstart. Create a service that will send an email and invoke it from the service task.

As for storing email server configuration in app.properties file. For each customer you can create a local.app.properties file that overrides only required properties and is stored in the tomcat conf directory. See https://doc.cuba-platform.com/manual-6.0/app_properties_files.html.
But actually, the initial source of emailer properties is a database. You can see it if you look at the EmailerConfig.java class. So instead of defining emailer configuration in the properties file you can use ConfigStorage JMX bean.

  • Open the Administration -> JMX Console.
  • Search for ConfigStorage bean there. Open the one that is for app-core module.
  • Find the setDbProperty() method, type property name and value there and click “Invoke” button.

In the next major release we plan to create a screen for easy database configs administration.

Thanks for the explanation Maxim. That’s really good to know.