It was asked of me how one would send the previous day's Data Point events in an email. One can achieve this pretty easily with a Scripting data source and a custom FTL model, like,

Scripting data source script (will send an email at validation!):

var now = new Date().getTime();
var from = now - 86400000;
var recipients = ["you@doman.extension"];

var eventList =, "DATA_POINT", null, -1, null, from, 
  now, 1, com.serotonin.m2m2.Common.getTranslations(), java.lang.Integer.MIN_VALUE, java.lang.Integer.MAX_VALUE, null);

var model = {"eventList": eventList, "CODES": com.serotonin.m2m2.rt.event.AlarmLevels.CODES};
var template = com.serotonin.m2m2.Common.freemarkerConfiguration.getTemplate("mytemplate.ftl");
var writer = new;
template.process(model, writer);
var emailContent = new com.serotonin.web.mail.EmailContent(null, writer.toString(), com.serotonin.m2m2.Common.UTF8);, "Event Summary", emailContent, null);

and then an email template like the following (saved in Mango/overrides/ftl, but you may need to restart if you didn't already have an overrides/ftl folder, or saved in Mango/ftl/)

.rowHeader td {
  font-weight: bold;
  color: #FFFFFF;
  background-color: #F07800;
  text-align: center;
  white-space: nowrap;
  padding: 3px 10px 3px 10px;
.row td, .rowAlt td {
  color: #000000;
  padding: 3px;
.row td {
  background-color: #F0F0F0;
.rowAlt td {
  background-color: #DCDCDC;
<#assign row = 1/>
<tr class="rowHeader">
	<th>Alarm Level</th>
<#list eventList as event>
<#assign row = row + 1/>
<#if row == 2><#assign row = 0/></#if>
<tr class="row<#if row == 1>Alt</#if>">
  <td><#if event.isRtnApplicable() && !event.isActive()>
  <#else>No RTN</#if></td>
  <td><#if event.isAcknowledged()>
  <#else>No Ack</#if></td>

One can see in the script that the name of my template file is mytemplate.ftl