FreeMarker

Apache FreeMarker is a free Java-based template engine, originally focusing on dynamic web page generation with MVC software architecture.

FreeMarker had a somewhat hectic history until about 2004, caused by paradigm shifts and other significant changes on multiple occasions.

The main goal of the changes was to make the template language more strict, i.e., to detect as many of the typos and other typical mistakes as possible.

Also the exact Java API (and hence the class) of the values can be hidden in FreeMarker using a technique called object wrapping.

For example, "messages" seems to be a list or array of JavaBeans that have "from" and "body" properties, but it might as well be something very different, and the template is not affected (as long as a proper object wrapper is used).