TIP: How to personalize emails in CiviCRM

This is a quick and easy tip to personalize your email blasts and it also takes into consideration the fact that you might not have a first name for all your contacts.  If this blog is helpful, be sure to check out my other blog: "The Many ways of Personalizing and Targeting Emails using CiviCRM". 


How many times have you gotten emails with the Salutation, space and a comma?  Not very personable!

CiviCRM Tip:  Use Smarty Templates to Personalize Emails


Try using instead the Smarty Templates.  

NOTICE:  In order for Smarty to work in CiviMail, you must add (or modify) a line to your civicrm.settings.php file located under sites/default/ for Drupal and administrator/components/com_civicrm for Joomla.  Place the following below the line define( 'CIVICRM_MEMCACHE_PREFIX', '' ); Or if these lines exist in your settings file, change the 0 (false) to 1 (true).

 * 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', 1 );


Once you modify your settings, you are ready to type the following in the body of your email:

{capture assign=first_name}{contact.first_name}{/capture}
Dear {$first_name|default:Friend},
This way, even if the first name field is empty, it will say Friend (as this is the default).  Please note that you can change the default to read anything you want.
CiviCRM Tip:  Use Smarty Templates to Personalize Emails
There's a lot of other cool things that you can do with this "smarty" functionality, including "If" statements.  For example, if your membership type = lapse, remind them of all the benefits they receive from their membership.  Otherwise, if the membership type = active, thank them for their support.   If you need to run some ideas by us please let us know.

Related Blog Posts



Technologies for Nonprofits