Ahmed Hasan 9 Years Ago Good to Have this feature. Just to share with you, for some of the our applications, we have used a "Web Content" as the email template and access the content with it's name programmatically inside the code, replace the tokens with run time values and fire the email. This way we can change the contents anytime on the fly and also send customised emails to users based on their geography and language. Here is the API to pick up the most recent article (Web Content) with it's name. public static String getEmailTemplate(String articleId) { long companyId = CompanyThreadLocal.getCompanyId(); String emailTemplate = StringPool.BLANK; DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass( JournalArticle.class, PortalClassLoaderUtil.getClassLoader()); dynamicQuery.add(RestrictionsFactoryUtil.eq("companyId", companyId)); dynamicQuery.add(RestrictionsFactoryUtil.eq("articleId", articleId)); dynamicQuery.addOrder(OrderFactoryUtil.desc("version")); try { @SuppressWarnings("unchecked") List<JournalArticle> articles = JournalArticleLocalServiceUtil.dynamicQuery(dynamicQuery); for (JournalArticle journalArticle: articles) { try { emailTemplate = JournalArticleLocalServiceUtil.getArticleContent( journalArticle, null, null, "en_US", null); break; } catch (PortalException e) { e.printStackTrace(); } } } catch (SystemException e) { e.printStackTrace(); } return emailTemplate; }================After programmatically obtaining the Email template, replace the values during runtime as shown here… public static void sendInvitation(long invitationId, String inviterEmail, String inviterName, String inviteeEmail, String inviteeName) { MailMessage mailMessage = new MailMessage(); mailMessage.setFrom(getFrom()); mailMessage.setTo(getTo(inviteeEmail, inviteeName)); InternetAddress[] replyTo = new InternetAddress[]{getTo(inviterEmail, inviterName)}; mailMessage.setReplyTo(replyTo); StringBuilder sb = new StringBuilder(); sb.append("Inviation from ").append(inviterName).append("to join hasnain"); mailMessage.setSubject(sb.toString()); String mailBody = getEmailTemplate("PORTAL_INVITATION"); String[] tokens = {"[$INVITER_NAME$]", "[$INVITATION_ID$]"}; String[] replacements = {inviterName, String.valueOf(invitationId)}; mailBody = StringUtil.replace(mailBody, tokens, replacements); mailMessage.setBody(mailBody); MailServiceUtil.sendEmail(mailMessage); } Please sign in to reply. Reply as... Cancel Chema Balsas Ahmed Hasan 9 Years Ago Hi Ahmed,Thanks for sharing! Your idea looks quite interesting. We've been considering adding that kind of support through ADT... would that solve your use case as well?If you'd like to see this implemented in core, you could open a Feature Request in https://www.liferay.com/community/ideas. The most voted ones have high chances of getting picked up for next versions Please sign in to reply. Reply as... Cancel
Chema Balsas Ahmed Hasan 9 Years Ago Hi Ahmed,Thanks for sharing! Your idea looks quite interesting. We've been considering adding that kind of support through ADT... would that solve your use case as well?If you'd like to see this implemented in core, you could open a Feature Request in https://www.liferay.com/community/ideas. The most voted ones have high chances of getting picked up for next versions Please sign in to reply. Reply as... Cancel
Marcellus Tavares 9 Years Ago That's really cool. Thanks for sharing Chema! Please sign in to reply. Reply as... Cancel
Denis Signoretto 9 Years Ago Hi Chema, does it means that all *.tmpl messages of portal.properties can be localized ? Please sign in to reply. Reply as... Cancel Chema Balsas Denis Signoretto 9 Years Ago Hey Denis! Yes, that's the idea. It should apply to all *.tmpl files in portal properties regarding email notifications. Furthermore, you should be able to do the same for any other templatized content you wished to localize for sending emails. Please sign in to reply. Reply as... Cancel Denis Signoretto Chema Balsas 9 Years Ago Great! so will be this feature available in plugins and Social Office too ? Please sign in to reply. Reply as... Cancel Chema Balsas Denis Signoretto 9 Years Ago Hey Denis,Yes, now that the framework allows for it, we should have all email notifications in plugins (SO, Knowledge Base, Calendar...) using the new infrastructure by the time we release the next version.In fact, we're about to start working on integrating it for Knowledge Base (https://issues.liferay.com/browse/LPS-50889). Feel free to submit contributions for any of the others! ;) Please sign in to reply. Reply as... Cancel
Chema Balsas Denis Signoretto 9 Years Ago Hey Denis! Yes, that's the idea. It should apply to all *.tmpl files in portal properties regarding email notifications. Furthermore, you should be able to do the same for any other templatized content you wished to localize for sending emails. Please sign in to reply. Reply as... Cancel Denis Signoretto Chema Balsas 9 Years Ago Great! so will be this feature available in plugins and Social Office too ? Please sign in to reply. Reply as... Cancel Chema Balsas Denis Signoretto 9 Years Ago Hey Denis,Yes, now that the framework allows for it, we should have all email notifications in plugins (SO, Knowledge Base, Calendar...) using the new infrastructure by the time we release the next version.In fact, we're about to start working on integrating it for Knowledge Base (https://issues.liferay.com/browse/LPS-50889). Feel free to submit contributions for any of the others! ;) Please sign in to reply. Reply as... Cancel
Denis Signoretto Chema Balsas 9 Years Ago Great! so will be this feature available in plugins and Social Office too ? Please sign in to reply. Reply as... Cancel Chema Balsas Denis Signoretto 9 Years Ago Hey Denis,Yes, now that the framework allows for it, we should have all email notifications in plugins (SO, Knowledge Base, Calendar...) using the new infrastructure by the time we release the next version.In fact, we're about to start working on integrating it for Knowledge Base (https://issues.liferay.com/browse/LPS-50889). Feel free to submit contributions for any of the others! ;) Please sign in to reply. Reply as... Cancel
Chema Balsas Denis Signoretto 9 Years Ago Hey Denis,Yes, now that the framework allows for it, we should have all email notifications in plugins (SO, Knowledge Base, Calendar...) using the new infrastructure by the time we release the next version.In fact, we're about to start working on integrating it for Knowledge Base (https://issues.liferay.com/browse/LPS-50889). Feel free to submit contributions for any of the others! ;) Please sign in to reply. Reply as... Cancel
Srikanth komma 9 Years Ago This is what the feature which i have searched and requested for it.at the time i have implemented with the help web content localization.for details.https://www.liferay.com/community/forums/-/message_boards/message/12795025Any ways ...happy to see this feature.. Please sign in to reply. Reply as... Cancel
Mouissaoui Insaf 5 Years Ago Hello it is very urgent thank you for answering me I have a problem integrating the text editor into the knowledge bases Thanks for your help Please sign in to reply. Reply as... Cancel