As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
<b>A new document '${document.name}'</b>, is available. It was added by ${person.properties.firstName}<#if person.properties.lastName?exists> ${person.properties.lastName}</#if>. Regards Alfresco
MimeMessageHelper message = new MimeMessageHelper(mimeMessage, true); System.out.println(email + " " + from); message.setTo(email); message.setSubject(subject); System.out.println("body :" + body); message.setText(body, true); message.setFrom(from); message.setReplyTo(new InternetAddress(from));
code is like this:MimeMessageHelper message = new MimeMessageHelper(mimeMessage, true); System.out.println(email + " " + from); message.setTo(email); message.setSubject(subject); System.out.println("body :" + body); message.setText(body, true); message.setFrom(from); message.setReplyTo(new InternetAddress(from));and this is not the code that is used in alfresco, they use message.setText(body); and mail is not HTML
public void notifyUser(NodeRef person, NodeRef node, final String from, String roleText) { final String to = (String)this.getNodeService().getProperty(person, ContentModel.PROP_EMAIL); if (to != null && to.length() != 0) { String body = this.body; if (this.usingTemplate != null) { FacesContext fc = FacesContext.getCurrentInstance(); // use template service to format the email NodeRef templateRef = new NodeRef(Repository.getStoreRef(), this.usingTemplate); ServiceRegistry services = Repository.getServiceRegistry(fc); Map<String, Object> model = DefaultModelHelper.buildDefaultModel( services, Application.getCurrentUser(fc), templateRef); model.put("role", roleText); model.put("space", node); // object to allow client urls to be generated in emails model.put("url", new BaseTemplateContentServlet.URLHelper(fc)); body = services.getTemplateService().processTemplate("freemarker", templateRef.toString(), model); } this.finalBody = body; MimeMessagePreparator mailPreparer = new MimeMessagePreparator() { public void prepare(MimeMessage mimeMessage) throws MessagingException { MimeMessageHelper message = new MimeMessageHelper(mimeMessage); message.setTo(to); message.setSubject(subject); message.setText(finalBody,true); //HIRE IS THE CHANGE. message.setFrom(from); } }; if (logger.isDebugEnabled()) logger.debug("Sending notification email to: " + to + "\n…with subject:\n" + subject + "\n…with body:\n" + body); try { // Send the message this.getMailSender().send(mailPreparer); } catch (Throwable e) { // don't stop the action but let admins know email is not getting sent logger.error("Failed to send email to " + to, e); } } }
Well I did not find way to override this problem so org.alfresco.web.bean.users.TemplateMailHelperBean this is the class, you can it is located inside of alfesco-web-client.jar, and you can just rebuld it( no need to rebuild all of the alfresco) . public void notifyUser(NodeRef person, NodeRef node, final String from, String roleText) { final String to = (String)this.getNodeService().getProperty(person, ContentModel.PROP_EMAIL); if (to != null && to.length() != 0) { String body = this.body; if (this.usingTemplate != null) { FacesContext fc = FacesContext.getCurrentInstance(); // use template service to format the email NodeRef templateRef = new NodeRef(Repository.getStoreRef(), this.usingTemplate); ServiceRegistry services = Repository.getServiceRegistry(fc); Map<String, Object> model = DefaultModelHelper.buildDefaultModel( services, Application.getCurrentUser(fc), templateRef); model.put("role", roleText); model.put("space", node); // object to allow client urls to be generated in emails model.put("url", new BaseTemplateContentServlet.URLHelper(fc)); body = services.getTemplateService().processTemplate("freemarker", templateRef.toString(), model); } this.finalBody = body; MimeMessagePreparator mailPreparer = new MimeMessagePreparator() { public void prepare(MimeMessage mimeMessage) throws MessagingException { MimeMessageHelper message = new MimeMessageHelper(mimeMessage); message.setTo(to); message.setSubject(subject); message.setText(finalBody,true); //HIRE IS THE CHANGE. message.setFrom(from); } }; if (logger.isDebugEnabled()) logger.debug("Sending notification email to: " + to + "\n…with subject:\n" + subject + "\n…with body:\n" + body); try { // Send the message this.getMailSender().send(mailPreparer); } catch (Throwable e) { // don't stop the action but let admins know email is not getting sent logger.error("Failed to send email to " + to, e); } } }this would be in your case, because you are using notifying the users of space change. this change would not take more then 20 min. hope it helped.