Search code examples
liferayliferay-6liferay-ide

Liferay 6.2 Custom Font family in email notifications


I would like to know how is it possible to change the font family of the body of the email notification.

Regarding general mail notifications, control panel editor does not provide this possibility.

Regarding workflow mail notifications and other portlet mail notifications like message boards or calendar, I still see no such possibility.

Any help will be appreciated.


Solution

  • Problem is quite tricky, however we found a working solution. We managed to solve it in our project using kaleo workflow notifications. I assume you have already background how to use kaleo so here is just part of the code used in our workflow definition responsible for email notifications in one of the actions taken by users.

        <notification>
                    <name>Creator Modification Email Notification</name>
                    <description>[Rejection] Your article has been rejected.</description>
                    <template>
                        <![CDATA[
                        <html>
                            <head><style>table, th, td {border: 1px solid black; border-collapse: collapse;}th, td { padding: 5px;text-align: left;}</style><head>
                            <body>
                                <p>Lorem ipsum...</p>
                                ###....
                                ##some settings removed to make it look more clear
                                ##
    
    
                                <table>
                                    <tr><th colspan="2"><b>Some information about rejected article</b></th></tr>
                                ## another information removed to make it look more clear for you
                                </table>
                            </body>
                    ]]>
                    </template>
                    <template-language>velocity</template-language>
                    <notification-type>email</notification-type>
                    <execution-type>onAssignment</execution-type>
                </notification>
    

    As you can see we used html to render this notification email. Also part of css was included in header section to make it possible look more elegant for end user. There shouldn't be any problem to add more specified css style including fonts and so on.

    BTW: Make sure to upload this definition of workflow as xml, since there was a bug over half year ago, which was clearing definition from all special characters, and in the end, you were not able to use such template. This was still possible to use their liferay uploader and use you workflow_definition.xml file. I hope I helped you somehow, solve this problem.