Do conditional statements with tokens not work when you manually send an email or 'print' a thank you letter? I have a bunch set up inside the auto generated emails for contribution receipts or event registrations but when I add a statement to a message template - and send it out using 'actions - send email to contacts' or 'actions - thank you letters for contributions' the if statement is ignored.

(I'm in Wordpress 4.3.2 and Civi 4.6.4)

1 Answer 1


Yes, what you are describing is the default setting for CiviCRM.

Only Message Templates and Automated Messages make use of the so called smarty template engine. The smarty template engines makes "if"-statements possible. The reason for this is that these Templates and Automated Messages are for more experienced users and administrators.

Normal mails, mailings and pdf reports can be used by regular CiviCRM users. And it might make their daily work much more difficult if they suddenly run into smarty template coding.

But, this is only the default setting. In your civicrm.settings.php is an option to override this and expose the smarty template engine to normal email too:

 * Enable this constant, if you want to send your email through the smarty
 * templating engine(allows you to do conditional and more complex logic)
define( 'CIVICRM_MAIL_SMARTY', 0 );

Set this to 1 and you can use "if"-statements in normal email.

  • Totally makes sense that you could turn this on and off. Thanks for letting me know this was an easy fix! I'm now running across a parse error where it keeps adding an unexpected & in the php that ends up running the if statement. Trying to work through that now....
    – RayWright
    Commented Jan 14, 2016 at 22:14

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.