如何在露天改变电子邮件的“回复”属性

时间:2018-03-01 10:35:58

标签: alfresco

我可以使用Java API在alfresco中发送电子邮件,但我无法在alfresco中更改“Reply-to:”属性:

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());

这是我发送电子邮件的代码

         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();
            }

有没有办法在alfresco中启用这个replyTo参数? 请帮忙。

1 个答案:

答案 0 :(得分:0)

我已经覆盖了OOTB MailActionExecuter类。 添加了我的代码来设置replyTo参数 我修复了java类mailAction.setParameterValue(MailActionExecuter.PARAM_REPLY_TO,"myEmail@gmail.com");

中的参数

并使用

进行访问
public static final String PARAM_REPLY_TO = "reply_to";

message.setReplyTo(replyTo);