Question
How can I personalize the greeting in an email using a contact's first name?
Answer
The most common use of logic in Templates is addressing the message to the contact in the following manner:
Dear [FIRST],
This can be done using the following logic statement:
%%if first != "" then print "Dear\+"%%%%$first%%%%if first != "" then print ","%%
This statement is two logical statements and a simple personalization tag combined. If the first name is blank, then nothing is printed at all.
The first part of the statement prints "Dear " if the first name field is not empty or blank. The space after "Dear" is created with the special character combination "\+".
The second part of the statement is the %%$first%% tag, which prints the contents of the contact's first name field if it is not empty. Logic is not necessary to print a blank, because if the first name is empty, nothing will be printed.
The third portion of the statement then prints a comma if the first name field is not empty or blank.
Alternately, you could use the following statement:
Dear %%if first = "" then print "Friend" else printdata first%%,
This would print "Dear Friend," if the first name field is empty, and print "Dear [FIRST]," if not empty.