Today with Axon.ivy 6.1 and older it's not possible to send task mails from the designer. The main blockers are:
- the mail servlet (ch.ivyteam.ivy.webserver.internal.IvyMailServlet) which generates the content of the task mail is not bound at designer time.
- tasks mails require the system application 'System' and its process model 'IvyCommons'. But at design time only one application 'Designer' is available
Other difficulties which can be fixed/configured:
- the task mail sender job does not respect the designer mail preferences. therefore the system wide mail properties of the engine have to be modified e.g. in a utitlity process
- the project that provides the task notification mail content process must be registered with an utitily process api call
- the designer app does not send any task mails by default. however with a JsfWorkflowUi or similar a test user can override his mail settings and enable task mails for any new task.
- the designer test user must have a mail address configured
sample utility code to enable mail sending in the designer:
package mailGenerator;
import ch.ivyteam.di.restricted.DiCore;
import ch.ivyteam.ivy.application.IApplication;
import ch.ivyteam.ivy.application.IApplicationConfigurationManager;
import ch.ivyteam.ivy.environment.Ivy;
import ch.ivyteam.ivy.security.IEMailNotificationSettings;
import ch.ivyteam.ivy.system.IProperty;
import ch.ivyteam.ivy.workflow.StandardProcessType;
/**
* Enable task mails in the designer to be generated with the JsfWorkflowUi
*/
public class DesignerMailUtitily {
public static void configure()
{
configureEngineMailProperties();
enableDesignerApplicationMails();
useMailProcessFromJsfWorkflowUi();
}
private static void useMailProcessFromJsfWorkflowUi() {
Ivy.wf().setStandardProcessImplementationLibrary(
StandardProcessType.MailNotificationNewTask, "JsfWorkflowUi");
}
private static void enableDesignerApplicationMails() {
IApplication designerApp = Ivy.wf().getApplication();
IEMailNotificationSettings mailSettings = designerApp.getDefaultEMailNotifcationSettings();
mailSettings.setNotificationDisabled(false);
mailSettings.setSendOnNewWorkTasks(true);
designerApp.setDefaultEMailNotifcationSettings(mailSettings);
}
/**
* configure the minimal engine properties so that i can work with 'smtp4dev' or similar
*/
private static void configureEngineMailProperties() {
IApplicationConfigurationManager appManager = DiCore.getGlobalInjector()
.getInstance(IApplicationConfigurationManager.class);
IProperty host = appManager.getSystemProperty("EMail.Server.Host");
host.setValue("localhost");
}
}