
malle.example.malle-freemarker-example.0.1.0.source-code.sample.ftl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of malle-freemarker-example Show documentation
Show all versions of malle-freemarker-example Show documentation
Example of using Freemarker template for composing a mail
The newest version!
<#assign from = '${from!mail_user}'/>
<#assign to_firstName = '${to_firstName!"Mr"}'/>
<#assign to_lastName = '${to_lastName!"X"}'/>
<@mail cmd='from' address='${from}'/>
<@mail cmd='to' address='${to}' personal='${to_firstName} ${to_lastName}'/>
<#-- Leading and trailing whitespace in the header values gets trimmed. -->
<@mail cmd='subject' value='A message for ${to_firstName} ${to_lastName} sent using Malle and Freemarker'/>
<#-- Whitespace in the text/html part gets trimmed. -->
<@mail cmd='html'><#escape x as x?html>
Hello ${to_firstName} ${to_lastName},
<#-- Unicode works as expected. -->
This is a sample mail from ${from} sent to you using Malle ♡ Freemarker.
#escape>@mail>
<#-- Only trailing whitespace in the text/plain part gets trimmed. -->
<@mail cmd='plain'>
Hello ${to_firstName} ${to_lastName},
It's sad that you don't have an HTML-capable mail reader :(
@mail>
<@mail cmd='attachment' name='image1.png' resource='image1.png'/>
<@mail cmd='inline' id='cat.jpg' url='https://upload.wikimedia.org/wikipedia/commons/thumb/0/04/So_happy_smiling_cat.jpg/411px-So_happy_smiling_cat.jpg'/>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy