Answers.Body: <p>{/fi} isn't the right syntax to close the if, use {/if}</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-08-19T09:44:10.397Z
Answers.Text: Gosh... How could I oversee that?
Answers.UserDisplayName: Pierre François
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-08-19T00:14:54.363Z
Answers.LastActivityDate: 2021-08-19T00:14:54.363Z
Answers.UserDisplayName: Demerit
Body: <p>I try to send single emails (Contacts &gt; New Email) using a message template containing smarty conditional instructions in the html part of the message and in the text part of it.</p>
  <p>HTML format:</p>
  <pre><code>&lt;p&gt;{capture assign=lang}{contact.preferred_language}{/capture}&lt;/p&gt;
  
  &lt;p&gt;{contact.email_greeting} ({$lang}),&lt;/p&gt;
  
  &lt;p&gt;{if $lang == 'fr_FR'}OK{/fi}&lt;/p&gt;
  </code></pre>
  <p>Plain-Text Format</p>
  <pre><code>{capture assign=lang}{contact.preferred_language}{/capture}
  {contact.email_greeting} ({$lang}),
  {if $lang == 'fr_FR'}OK{/fi}
  </code></pre>
  <p>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.</p>
  <p>The ´{capture}` instructions work as expected.</p>
  <p>But whatever I try to do, every time I include the <code>{if}</code> 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.</p>
  <p>I don't understand why this simple construction is not working.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-08-18T20:52:28.430Z
Comments.Text: how does this relate to your question  2 days ago https://civicrm.stackexchange.com/questions/40200/is-smarty-processing-also-available-for-sending-single-mails-which-are-not-a-par
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-08-19T09:43:36.920Z
Comments.Text: @petednz-fuzion: Some days ago, it worked once, but I couldn't reproduce this behaviour.
Comments.UserDisplayName: Pierre François
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-08-19T09:54:22.260Z
Comments.Text: @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.
Comments.UserDisplayName: Pierre François
Tags: <civimail><smarty>
Title: Smarty if instruction in message templates not working in single mails
ThreadText: # Smarty if instruction in message templates not working in single mails
  
  (Asked by: username_0 on 2021-08-18)
  
  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:
  {capture assign=lang}{contact.preferred_language}{/capture}
  
  {contact.email_greeting} ({$lang}),
  
  {if $lang == 'fr_FR'}OK{/fi}
  
  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.
  
  **Tags:** civimail, smarty
  
  > **Comments:**
  > **username_1**: how does this relate to your question  2 days ago https://civicrm.stackexchange.com/questions/40200/is-smarty-processing-also-available-for-sending-single-mails-which-are-not-a-par  
  > **username_0**: @petednz-fuzion: Some days ago, it worked once, but I couldn't reproduce this behaviour.  
  > **username_0**: @petednz-fuzion: Thanks to username_2, I see where I introduced a new error: it was a tipo: `{/fi}` instead of `{/if}`, and so muy problem is fixed again.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2021-08-19. Score: 2 | Accepted answer
  
  {/fi} isn't the right syntax to close the if, use {/if}
  
  > **Comments:**
  > **username_0**: Gosh... How could I oversee that?  
  
  ---
  
  