I am able to send emails in alfresco using Java API but I am not able to change the "Reply-to: " property like this in alfresco :
Message replyMessage = new MimeMessage(session);
replyMessage = (MimeMessage) message.reply(false);
replyMessage.setFrom(new InternetAddress(to));
replyMessage.setText("Thanks");
replyMessage.setReplyTo(message.getReplyTo());
replyMessage.setReplyTo(message.getReplyTo());
This is my code to send emails
NodeRef companyHome = repository.getCompanyHome();
List<String> pathElements = new ArrayList<>();
pathElements.add("Data Dictionary");
pathElements.add("Email Templates");
pathElements.add("Trams Email Templates");
pathElements.add("CONTENT_NOTIFICATION.html.ftl");
FileInfo templateFile;
try {
templateFile = serviceRegistry.getFileFolderService()
.resolveNamePath(companyHome, pathElements);
NodeRef template = templateFile.getNodeRef();
List<String> users = new ArrayList<String>();
users.add(userName);
ActionService actionService = serviceRegistry.getActionService();
Action mailAction = actionService.createAction(MailActionExecuter.NAME);
mailAction.setParameterValue(MailActionExecuter.PARAM_TEMPLATE, template);
Map<String, Serializable> templateArgs = new HashMap<String, Serializable>();
templateArgs.put("userName", userName);
Map<String, Serializable> templateModel = new HashMap<String, Serializable>();
templateModel.put("args",(Serializable)templateArgs);
mailAction.setParameterValue(MailActionExecuter.PARAM_TEMPLATE_MODEL,(Serializable)templateModel);
mailAction.setParameterValue(MailActionExecuter.PARAM_SUBJECT, "Content Notification");
mailAction.setParameterValue(MailActionExecuter.PARAM_TO_MANY, (Serializable) users);
actionService.executeAction(mailAction, null);
} catch (org.alfresco.service.cmr.model.FileNotFoundException e) {
e.printStackTrace();
}
Is there any way to enable this replyTo parameter in alfresco ? Please help.
I have override the OOTB MailActionExecuter class.
added my code to set the replyTo parameter
I fixed parameter from java class mailAction.setParameterValue(MailActionExecuter.PARAM_REPLY_TO,"myEmail@gmail.com");
and access using
public static final String PARAM_REPLY_TO = "reply_to";
message.setReplyTo(replyTo);