I try to send a single mail through Contacts > New Mail using a template containing next Smarty instructions:
{if {contact.preferred_language} == "fr_FR"}OK{else}KO{/if}
but these mails cause an error with a very cryptic message:
Error
The website encountered an unexpected error. Please try again later.
EDIT: Thanks to Demerit (see below), I could identify what is working and what not. The smarty code
{capture assign=pref}{contact.preferred_language}{/capture}
{contact.email_greeting} ({contact.preferred_language} = {$pref}?),
is working as expected and gives the expected output
Monsieur (fr_FR = fr_FR?),
So, the {capture}
instruction is working, but when I add the instruction below
{if $pref == "fr_FR"}OK{/if}
I get the error message described above and no message is sent.