Versions Compared

Key

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

...

Email templates represent one of the first features of this app. Its initial implementation only allowed for simple variables to be injected into the templates. They are now based SIL SIL™ Template Language and therefore their usage got a lot easier than before.

To be short the email templates mechanism is prefered and recommended way of sending emails from SIL SIL™ scripts. The send Email() routine packs powerful tools.

Email templates obey the same rules as those presented in the general STL page above and in the previous chapter with some notable differences, introduced just to make your life easier.

...

If we look at the French support, you will see that above we use the same template for all the French speakers, no matter what country they come from. And if we look at the Romanian support, we'll see that, because the internationalization directory ('ro') is missing, it will default to the MAIL_TEMPLATES_BASE/template.tpl. 


Note
titleAdvice

If you need to send the same mail in multiple languages, do not mix templates used with the executeTemplate() routine with the sendEmail() routine. Keep them separate. Of course this is valid only if templates are different, if you use the same for both emails and something else, put them in the same place.

...


Additional Injected Variables

...

Code Block
titletemplate.tpl
<html>
<body>
Hello $reporter$ from $custName$, the sender $sender$ announces you that the assignee for issue $key$ is $assignee$ and that work has started
$!
//this is a simple script, not carrying too much meaning, but just used as an example.
for(number i = 0; i < 3; i++) {
    $
    <p>
        Hip!
    </p>
    $!
}
$
<p>
    Hooray!
</p>
</body>
</html>

...


Now, Hip! Hip! Hip! Hooray! will be put in your email (4 paragraphs). Use standard CSS to nicely format your html email messages.