Email Templates Customization in Alfresco

In previous article we had discussed importance of email sending in content management system and how to achieve that in alfresco.

Now out of box alfresco use these email templates for sending email which are again part of any out of box functionality. For instance site activities notification to site manager. There are many occasions where we want to send our customized email rather than out of box email. In that case we have two options:

1) Change existing template

2) Create new template and do changes in functionality to utilize our template for sending email.

First one is easier but it has risk associated that if the same templates are reused in other out of box functionalities it will affect them as well. Also make sure you are only changing text content not the parameters otherwise you will also have to do changes at location where it is called.

Steps involved in First implementation

  • Figure out the email template used for sending mail
  • Login as admin and navigate to location where all email templates are store. You can see all templates are uploaded under Data Dictionary>Email Templates
  • Edit template which is responsible for email sending. You can either use inline editing or off line editing

 

Alfresco Email Templates

Alfresco Email Templates

So, ideally second solution is better solution although it will require little bit of extra effort of making changes in functionality as well.

Steps involved in Second implementation will be as follow

  • Figure out code which is responsible for sending email using template. For instance in workflows you will find related code in out of box workflow process definition file.
  • Create your custom template with required details
  • Upload your template within alfresco.
  • Change code which you have found in step1 to point to your custom template rather than out of box template.
  • Make sure you are passing all necessary parameters while calling template.

Note: For changes in workflow process definition you will also have to change workflow context file where you will have to make “redeploy” as true for related workflow entry otherwise your changes will not be in effect.

For Example if you take example of previous article you could notice this line which is responsible for sending email with template

mail.parameters.template = companyhome.childByNamePath(“Data Dictionary/Email Templates/wf-email.html.ftl”);

Now to use our custom template you can create your template something called like “wf-myemail-template.html.ftl” upload it in alfresco and change line as follow

mail.parameters.template = companyhome.childByNamePath(“Data Dictionary/Email Templates/ wf-myemail-template.html.ftl “);

This is how we can do customization in alfresco email templates.

Looking for quality Alfresco Web Hosting? Look no further than Arvixe Web Hosting!

Tags: , , , , , , | Posted under Alfresco | RSS 2.0

Author Spotlight

mitpatoliya

I love opensource technologies working with those technologies from the time I have stepped in to the Software Industry. Alfresco CMS is my area of expertise. I have worked on various complex implementations which involved integration of Alfresco with other technologies, extensively worked with JBPM workflows and Webscripts.

2 Comments on Email Templates Customization in Alfresco

  1. pawan bika says:

    Bro… I have a question. If i create my custom template and in that template i want to fetch my custom properties created in workflow model with their workflow tasks in BPMN engine….. how can i access them… are there javascript files of these templates available or not? Or is there any other solution??

Leave a Reply

Your email address will not be published. Required fields are marked *