Another improvement: I saw that you have hardcoded host names and smtp users in your demo. I'd stick to the configuration that is provided by the Axon.ivy Designer preferences or the Engines System Properties. You can easily re-use these configuration by using an internal API
@SuppressWarnings("restriction")
private Session prepareSession() {
ch.ivyteam.ivy.email.EmailSetupConfiguration emailConfig =
ch.ivyteam.ivy.email.EmailSetupProviderUtil.getEmailSenderConfiguration(Ivy.request().getProject());
Properties props = new Properties();
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.smtp.host", emailConfig.getSmtpServer());
props.put("mail.smtp.port", emailConfig.getSmtpPort());
props.put("mail.smtp.connectiontimeout", 2000);
Session session = Session.getInstance(props,
new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(emailConfig.getSmtpUser(), emailConfig.getSmtpPassword());
}
});
return session;
}
**Will you update the demo accordingly?**}