Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This process tool plugin sends an email message to the targeted recipient(s), with the ability to use a common body template via hash variable. 

You can use $(body) in the Message Body Template to display the content within the Message field.

Image Modified

With that, you can use Environment Hash Variable to create a template with $(body) to display the content within the Message. 

Create a new environment variable (i.e. template) and place the following sample code inside.

Image Modified

Code Block
languagexml
titleEnvironment Variable - template
linenumberstrue
<table role="presentation" align="center" border="0" cellspacing="0" cellpadding="0" width="100%" bgcolor="#F3F2EF" style="background-color: rgb(243, 242, 239); table-layout: fixed; padding-bottom:30px"> 
   <tbody> 
    <tr> 
        <td align="center" style="padding-top: 24px;"> 
             <center style="width: 100%;"> 
             <table role="presentation" border="0" cellspacing="0" cellpadding="0" width="512" bgcolor="#FFFFFF" style="background-color: rgb(255, 255, 255); margin: 0px auto; max-width: 512px; width: inherit;">
                     <tbody> 
                         <tr> 
                             <td bgcolor="#FFFFFF" style="background-color: rgb(255, 255, 255); padding: 18px 24px 0px;"> 
                                 <table role="presentation" border="0" cellspacing="0" cellpadding="0" width="100%" style="width: 100%; min-width: 100%;"> 
                                     <tbody> <tr> <td align="center" valign="middle">
                                     <h2 style="margin:0;color:#000000;font-weight:600;font-size:24px;line-height:1.167">Claim App</h2>
                                     </td></tr></tbody>
                                 </table>
                             </td>
                         </tr>
                     </tbody>
             </table>
             </center>
         </td>
     </tr>
     <tr> 
        <td align="center"> 
             <center style="width: 100%;"> 
             <table role="presentation" border="0" cellspacing="0" cellpadding="0" width="512" bgcolor="#FFFFFF" style="background-color: rgb(255, 255, 255); margin: 0px auto; max-width: 512px; width: inherit;">
                     <tbody> 
                         <tr> 
                             <td bgcolor="#FFFFFF" style="background-color: rgb(255, 255, 255); padding: 18px 24px 28px;"> 
                                 <table role="presentation" border="0" cellspacing="0" cellpadding="0" width="100%" style="width: 100%; min-width: 100%;"> 
                                     <tbody> <tr> <td align="left" valign="middle">
                                        $(body)
                                        <br/>
                                        <br/>Thanks.
                                     </td></tr></tbody>
                                 </table>
                             </td>
                         </tr>
                     </tbody>
             </table>
             </center>
         </td>
     </tr>
    </tbody>
</table>

Then, in "Message Body Template", key in the following.

Code Block
languagexml
titleMessage Body Template
linenumberstrue
#envVariable.template#

In this article, we are using the environment variable as a means to store the email template, but we can retrieve it anywhere else using other hash variables.

For example, we can store it in a specific form row (Record ID = 0) from the table named "setup".  You may also want to add "noescape" so that the returned template would stay intact. (Read more about Escaping the Resultant Hash Variable). We will then use Form Binder Hash Variable to retrieve it.

Code Block
languagexml
titleMessage Body Template
linenumberstrue
#form.setup.template[0]?noescape#

With this plugin, we can now modify the template without the need to modify each and every email tool can easily modify the template and affect all that uses said template without ever looking for each email tool plugin and modifying each of them.

Image Modified

JOGET OSS

The plugin is also available open-source at  jogetoss/email-tool-with-template.