Answers.Body: <p>There used to be a diffence in the way tokens behave in the Email or PDF API, as far as I know this has been fixed in the latest versions of the extensions Email API and PDF API. Can you check if you have these latest versions installed?</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-20T18:22:58.947Z
Answers.Text: Hi Erik, E-mail API is 1.19 and PDF API is 2.4, so I guess up-to-date.
Answers.UserDisplayName: Guillaume Sorel
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-20T20:13:26.577Z
Answers.Text: And the Smarty switch in your civicrm.settings is on? I assume you are not using a  token?
Answers.UserDisplayName: ErikH - CiviCooP
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-21T08:23:53.143Z
Answers.Text: this is what I have in civicrm.settings :
  
  /**
   * Enable this constant, if you want to send your email through the smarty
   * templating engine(allows you to do conditional and more complex logic)
   *
   */
  if (!defined('CIVICRM_MAIL_SMARTY')) {
    define( 'CIVICRM_MAIL_SMARTY', 1 );
  }
  
  I don't use tokens just strings
Answers.UserDisplayName: Guillaume Sorel
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-21T08:42:15.513Z
Answers.Text: I do recommend using tokens if at all possible :-). As far as the problem goes: I can not really say from a distance if this behaviour is still a bug or something is wrong in your specific installation or use case unfortunately...:-(
Answers.UserDisplayName: ErikH - CiviCooP
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-21T08:46:03.410Z
Answers.Text: Ok I understand. This is not a major issue. How can I learn to use tokens?
Answers.UserDisplayName: Guillaume Sorel
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-21T09:08:28.040Z
Answers.Text: How to use tokens: https://docs.civicrm.org/user/en/latest/common-workflows/tokens-and-mail-merge/. How to create your own specific tokens: https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_tokens/ and https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_tokenValues/. An example extension: https://lab.civicrm.org/partners/civicoop/mediwe/mediwecustomtokens
Answers.UserDisplayName: ErikH - CiviCooP
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-21T09:43:56.673Z
Answers.Text: thanks Erik! just do it now! ;-)
Answers.UserDisplayName: Guillaume Sorel
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-20T15:22:57.767Z
Answers.LastActivityDate: 2019-11-20T15:22:57.767Z
Answers.UserDisplayName: ErikH - CiviCooP
Body: <p>I have a template with Smarty strings.</p>
  
  <p>If I send the email from inside CiviCRM, Smarty works fine (it shows "Cher Guillaume"):</p>
  
  <p><a href="https://i.sstatic.net/8bthZ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/8bthZ.png" alt="enter image description here"></a></p>
  
  <p>If I send the same template using a CiviRule, it doesn't work:</p>
  
  <p><a href="https://i.sstatic.net/53Yod.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/53Yod.png" alt="enter image description here"></a></p>
  
  <p>although it attaches a .pdf file with Smarty Strings inside that also work fine.</p>
  
  <p>Is there a reason related to CiviRule?</p>
  
  <p>Any idea?</p>
  
  <p>best Regards</p>
  
  <p>Guillaume</p>
  
Tags: <civirules><smarty>
Title: Smarty with CiviRules
ThreadText: # Smarty with CiviRules
  
  (Asked by: username_0 on 2019-11-20)
  
  I have a template with Smarty strings.
  
  If I send the email from inside CiviCRM, Smarty works fine (it shows "Cher Guillaume"):
  
  [![enter image description here](https://i.sstatic.net/8bthZ.png)](https://i.sstatic.net/8bthZ.png)
  
  If I send the same template using a CiviRule, it doesn't work:
  
  [![enter image description here](https://i.sstatic.net/53Yod.png)](https://i.sstatic.net/53Yod.png)
  
  although it attaches a .pdf file with Smarty Strings inside that also work fine.
  
  Is there a reason related to CiviRule?
  
  Any idea?
  
  best Regards
  
  Guillaume
  
  **Tags:** civirules, smarty
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-11-20. Score: 1
  
  There used to be a diffence in the way tokens behave in the Email or PDF API, as far as I know this has been fixed in the latest versions of the extensions Email API and PDF API. Can you check if you have these latest versions installed?
  
  > **Comments:**
  > **username_0**: Hi Erik, E-mail API is 1.19 and PDF API is 2.4, so I guess up-to-date.  
  > **username_1**: And the Smarty switch in your civicrm.settings is on? I assume you are not using a  token?  
  > **username_0**: this is what I have in civicrm.settings :  /**  * Enable this constant, if you want to send your email through the smarty  * templating engine(allows you to do conditional and more complex logic)  *  */ if (!defined('CIVICRM_MAIL_SMARTY')) {   define( 'CIVICRM_MAIL_SMARTY', 1 ); }  I don't use tokens just strings  
  > **username_1**: I do recommend using tokens if at all possible :-). As far as the problem goes: I can not really say from a distance if this behaviour is still a bug or something is wrong in your specific installation or use case unfortunately...:-(  
  > **username_0**: Ok I understand. This is not a major issue. How can I learn to use tokens?  
  > **username_1**: How to use tokens: https://docs.civicrm.org/user/en/latest/common-workflows/tokens-and-mail-merge/. How to create your own specific tokens: https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_tokens/ and https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_tokenValues/. An example extension: https://lab.civicrm.org/partners/civicoop/mediwe/mediwecustomtokens  
  > **username_0**: thanks Erik! just do it now! ;-)  
  
  ---
  
  