How to add salutations to Email Template
Take a look at these code examples and their proper use. But first distinguish what the exact email type is and who the recipient is.
To access the email templates and themes, click on the Configuration Icon > Templates > Notifications and click on either Templates or Themes tab.
General Remarks
Some placeholders can only be used with certain addressees but not with others. See below:
- ${emailRecipient.firstName}
for internal users and contact persons: displays first name
for clients and vendors: cannot be used
- ${emailRecipient.lastName}
for internal users and contact persons: displays last name
for clients and vendors: cannot be used
- ${emailRecipient.name}
for internal users and contact persons: displays first name
for clients and vendors: displays the content of the "Name" field (i.e. short name for companies or first and last name for people)
- ${emailRecipient.displayName}
for internal users and contact persons: displays first and last name
for clients and vendors: displays the content of the "Name" field (i.e. short name for companies or first and last name for people)
Code Snippets
We will use Spanish in the examples below. What we want to achieve is phrases like "Estimado Sr. Marquez" or "Estimada Sra. Lopez" depending on the gender indicated in their XTRF profiles. If gender is not provided or the message is sent to a general address of the customer or vendor (think: office@ or projects@), then "Estimado/a ..." should be used.
The first script will work in emails sent to clients, vendors and their contacts:
#set($s="")#if(${emailRecipient.person})#if($utils.unwrap(${emailRecipient}).gender.name()=="MALE")Estimado Sr. ${emailRecipient.lastName}:#elseif($utils.unwrap(${emailRecipient}).gender.name()=="FEMALE")Estimada Sra. ${emailRecipient.lastName}:#else${s}Estimado/a ${emailRecipient.displayName}:#end#else${s}Estimado/a ${emailRecipient.displayName}:#end
But you would have to use the following script in emails sent to internal users, e.g. Project Managers:
#set($s="")#if($utils.unwrap(${emailRecipient}).gender.name()=="MALE")Estimado Sr. ${emailRecipient.lastName}:#elseif ($utils.unwrap(${emailRecipient}).gender.name()=="FEMALE")Estimada Sra. ${emailRecipient.lastName}:#else${s}Estimado/a ${emailRecipient.displayName}:#end
Customer support service by UserEcho