0

I try to send single emails (Contacts > New Email) using a message template containing smarty conditional instructions in the html part of the message and in the text part of it.

HTML format:

<p>{capture assign=lang}{contact.preferred_language}{/capture}</p>

<p>{contact.email_greeting} ({$lang}),</p>

<p>{if $lang == 'fr_FR'}OK{/fi}</p>

Plain-Text Format

{capture assign=lang}{contact.preferred_language}{/capture}
{contact.email_greeting} ({$lang}),
{if $lang == 'fr_FR'}OK{/fi}

For avoiding problems with the quotes in the smarty instructions being changed into entities, I disabled the CKeditor and I am editing the HTML part of the message in a textarea.

The ´{capture}` instructions work as expected.

But whatever I try to do, every time I include the {if} instruction in the HTML part as in the plain text part, that part of the mail is not sent. If I remove the conditional instruction, the other instructions work.

I don't understand why this simple construction is not working.

3
  • how does this relate to your question 2 days ago civicrm.stackexchange.com/questions/40200/…
    – petednz - fuzion
    Commented Aug 18, 2021 at 20:52
  • @petednz-fuzion: Some days ago, it worked once, but I couldn't reproduce this behaviour. Commented Aug 19, 2021 at 9:43
  • @petednz-fuzion: Thanks to Demerit, I see where I introduced a new error: it was a tipo: {/fi} instead of {/if}, and so muy problem is fixed again. Commented Aug 19, 2021 at 9:54

1 Answer 1

2

{/fi} isn't the right syntax to close the if, use {/if}

1
  • Gosh... How could I oversee that? Commented Aug 19, 2021 at 9:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.