Answers.Body: <p>I am a bit of a hurry at the moment - we use a greeting based on the prefix - maybe it helps:</p>
  
  <blockquote>
    <p>{capture assign=c}{contact.communication_style}{/capture}{capture assign=p}{contact.individual_prefix}{/capture}{if $p=="Frau"}Liebe{else}Lieber{/if}{ }{if $c=="Familiar"}{ }{contact.first_name}{else}{$p}{ }{contact.formal_title}{contact.last_name}{/if}</p>
  </blockquote>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-08T18:11:03.727Z
Answers.Text: Are you on 4.7.15? Because in my case, using the greeting with capture commands "crashes" CiviCRM page. Crashes as in it never finishes reloading the page. In the message context the variables are defined. Maybe they are not in the greeting context. Worth a try.
Answers.UserDisplayName: Codedogs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-09T02:45:41.837Z
Answers.Text: I tried just contract.preferred_language and just contact.gender and both resulted in a Network Error.
Answers.UserDisplayName: Codedogs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-09T07:16:21.647Z
Answers.Text: I just ried it on the sandbox which is on 4.7.17 - seems to work
Answers.UserDisplayName: Fabian
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-02T18:48:34.817Z
Answers.Text: I gave up and did it via SQL
Answers.UserDisplayName: Codedogs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-07T11:51:35.810Z
Answers.LastActivityDate: 2017-02-07T11:51:35.810Z
Answers.UserDisplayName: Fabian
Answers.Body: <p>Meanwhile, we have developed a new extension which may help people struggling with many different and or/complex greetings. The extension (including documentation) can be found <a href="https://github.com/systopia/de.systopia.moregreetings" rel="nofollow noreferrer">here</a>.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-06T06:58:48.310Z
Answers.LastActivityDate: 2018-02-06T06:58:48.310Z
Answers.UserDisplayName: Fabian
Body: <p>CiviCRM for WordPress 4.7.15</p>
  
  <p>Problem: Fix the Email Greeting, so it takes advantage of the preferred language and gender fields. I took a look at:</p>
  
  <p><a href="https://wiki.civicrm.org/confluence/display/CRMDOC/Recipe+for+German+Name+and+Greetings+Handling" rel="nofollow noreferrer">https://wiki.civicrm.org/confluence/display/CRMDOC/Recipe+for+German+Name+and+Greetings+Handling</a></p>
  
  <p>The page to edit the Email Greeting is hidden under <strong>Administration/System Settings/Option Groups - Email Type Greeting Options</strong></p>
  
  <p>I came up with the following which works nicely when used in a Smarty Message Template.</p>
  
  <pre><code>{capture assign=l}{contact.preferred_language}{/capture} 
  {capture assign=g}{contact.gender}{/capture} 
  {if $l="en_CA"}Dear{else}{if $g="Male"}Cher{else}Chère{/if}{/if} {contact.first_name} {contact.last_name}
  </code></pre>
  
  <p>To test it, one selects the new <strong>Email Greeting</strong> from the drop down on the <strong>Contacts Summary</strong> page in the <strong>Communication Preferences</strong> section. Then clicks Save. At this point, the CiviCRM says.</p>
  
  <p><a href="https://i.sstatic.net/JMX1K.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/JMX1K.png" alt="Error Message"></a></p>
  
  <p>Any suggestions? I'm considering adding 3 Greetings and updating all 2697 records via SQL. </p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-09-07T08:57:39.347Z
Comments.Text: In case this is still relevant, make sure that smarty is enabeld as described here: https://wiki.civicrm.org/confluence/display/CRMDOC/Smarty+in+mail+templates
Comments.UserDisplayName: Fabian
Tags: <wordpress><email><message-templates>
Title: Multilingual Email Greeting
ThreadText: # Multilingual Email Greeting
  
  (Asked by: username_0 on 2017-02-06)
  
  CiviCRM for WordPress 4.7.15
  
  Problem: Fix the Email Greeting, so it takes advantage of the preferred language and gender fields. I took a look at:
  
  <https://wiki.civicrm.org/confluence/display/CRMDOC/Recipe+for+German+Name+and+Greetings+Handling>
  
  The page to edit the Email Greeting is hidden under **Administration/System Settings/Option Groups - Email Type Greeting Options**
  
  I came up with the following which works nicely when used in a Smarty Message Template.
  
  ```
  {capture assign=l}{contact.preferred_language}{/capture} 
  {capture assign=g}{contact.gender}{/capture} 
  {if $l="en_CA"}Dear{else}{if $g="Male"}Cher{else}Chère{/if}{/if} {contact.first_name} {contact.last_name}
  
  ```
  
  To test it, one selects the new **Email Greeting** from the drop down on the **Contacts Summary** page in the **Communication Preferences** section. Then clicks Save. At this point, the CiviCRM says.
  
  [![Error Message](https://i.sstatic.net/JMX1K.png)](https://i.sstatic.net/JMX1K.png)
  
  Any suggestions? I'm considering adding 3 Greetings and updating all 2697 records via SQL.
  
  **Tags:** wordpress, email, message-templates
  
  > **Comments:**
  > **username_1**: In case this is still relevant, make sure that smarty is enabeld as described here: https://wiki.civicrm.org/confluence/display/CRMDOC/Smarty+in+mail+templates  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2017-02-07. Score: 1
  
  I am a bit of a hurry at the moment - we use a greeting based on the prefix - maybe it helps:
  
  > {capture assign=c}{contact.communication\_style}{/capture}{capture assign=p}{contact.individual\_prefix}{/capture}{if $p=="Frau"}Liebe{else}Lieber{/if}{ }{if $c=="Familiar"}{ }{contact.first\_name}{else}{$p}{ }{contact.formal\_title}{contact.last\_name}{/if}
  
  > **Comments:**
  > **username_0**: Are you on 4.7.15? Because in my case, using the greeting with capture commands "crashes" CiviCRM page. Crashes as in it never finishes reloading the page. In the message context the variables are defined. Maybe they are not in the greeting context. Worth a try.  
  > **username_0**: I tried just contract.preferred_language and just contact.gender and both resulted in a Network Error.  
  > **username_1**: I just ried it on the sandbox which is on 4.7.17 - seems to work  
  > **username_0**: I gave up and did it via SQL  
  
  ---
  
  ### Answer by username_1 on 2018-02-06. Score: 1
  
  Meanwhile, we have developed a new extension which may help people struggling with many different and or/complex greetings. The extension (including documentation) can be found [here](https://github.com/systopia/de.systopia.moregreetings).
  
  
  ---
  
  