Answers.Body: <p>You will need to turn on CIVICRM_MAIL_SMARTY in civicrm.settings.php to use smarty templating for conditional and more complex logic. </p>
  
  <p><a href="https://i.sstatic.net/z0dA9.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/z0dA9.png" alt="enter image description here"></a></p>
  
  <p>Cheers</p>
  
  <p>Pradeep</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-25T21:30:57.097Z
Answers.Text: I seem to receive thousands of smarty error in drupal every time the email is viewed after enabling this option!! how can I fix it please? thanks
Answers.UserDisplayName: Tapash
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-25T09:16:24.243Z
Answers.LastActivityDate: 2019-05-25T09:16:24.243Z
Answers.UserDisplayName: Pradeep Nayak
Body: <p>I need to send an email with Nickname as first preference, if that not present then use Contact name. Cant figure out what token to use? </p>
  
  <p>I have tried this but seems not rendering correctly in email:</p>
  
  <pre><code>{capture assign=nickname}{contact.nick_name}{/capture} 
  Dear {if $nickname}{contact.nick_name}{else}{contact.sort_name}{/if}
  </code></pre>
  
  <p>OUTPUT:</p>
  
  <pre><code>{capture assign=nickname}Tota{/capture} Dear {if $nickname}Tota{else}Mr. Tapash Datta{/if}
  </code></pre>
  
  <p>can anyone help please? Thanks</p>
  
Tags: <tokens><smarty>
Title: How to use Contact name if nickname is not present in bulk mail?
ThreadText: # How to use Contact name if nickname is not present in bulk mail?
  
  (Asked by: username_0 on 2019-05-25)
  
  I need to send an email with Nickname as first preference, if that not present then use Contact name. Cant figure out what token to use? 
  I have tried this but seems not rendering correctly in email:
  {capture assign=nickname}{contact.nick_name}{/capture} 
  Dear {if $nickname}{contact.nick_name}{else}{contact.sort_name}{/if}
  
  OUTPUT:
  {capture assign=nickname}Tota{/capture} Dear {if $nickname}Tota{else}Mr. username_0 Datta{/if}
  
  can anyone help please? Thanks
  
  **Tags:** tokens, smarty
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-05-25. Score: 3
  
  You will need to turn on CIVICRM\_MAIL\_SMARTY in civicrm.settings.php to use smarty templating for conditional and more complex logic.
  
  [![enter image description here](https://i.sstatic.net/z0dA9.png)](https://i.sstatic.net/z0dA9.png)
  
  Cheers
  
  Pradeep
  
  > **Comments:**
  > **username_0**: I seem to receive thousands of smarty error in drupal every time the email is viewed after enabling this option!! how can I fix it please? thanks  
  
  ---
  
  