Custom Email Format

Custom Email Format

If the user would like to use the email block and create the format the way the information appears in the email. They can do so using the "strVar" and "strMacro" combination linked to the body of the email block. Below is a simple example so you can apply the same concept into your program.

This is meant to use with the email block, which means it should be used on a program that runs onEvent! Not a normal routine otherwise you will be bombarded with constant emails every second.

Example

The below example is a simple onEvent program that contains a boolean variable (boolVar), string variable (strVar), strMacro block, and email block. The main focus is on the strVar and strMacro. There are other equip variables and they are damper, roomTemp, and occMode. They are just there to show example of how we can get the current value when the boolVar is true and display that on the email.

 

Html Editor

To start, we'll want to find an HTML Editor that we can use to create our email template. In this case we'll use "html-online" editor. And once there, clear the left side editor and start typing up how you would like the email to appear. You can use the available properties there to make it show you want. Below is our example.

To get the values of the variables, you would use '$' then the name of the variable. Its case sensitive so make sure its the same as you see it in the variables view.

Once done, copy the text on the right side. And open a text editor like notepad or something. Type in <html></html> and then paste your text in between those html blocks. If you like, you can do it in the html editor and then copying it after. Below is an example of how it should look after.

<html><p>This is an example email from the email block.</p>
<p>Below are the values for the variables:</p>
<p style="padding-left: 30px;"><strong>Damper</strong> is $damper</p>
<p style="padding-left: 30px;"><strong>Room Temp</strong> is $roomTemp</p>
<p style="padding-left: 30px;"><strong>Occ Mode</strong> is $occMode</p>
<p>That is it.</p></html>

Then copy the whole thing.

String Command

What we are going to do now is command the strVar in Logic Builder and paste that as the value.

  

Which then in the variables view, it should appear something like below.

Email

That should be it. Now when the logic runs and triggers an email. It should appear the same as what was typed in the html editor. Below is a copy of the email.