I want to personalize the salutation in the email sent to my contacts. When our list was originally imported, we used the word "unknown" as the first name for contacts who did not have a first name. I would like to personalize the content as follows:
- If first name exists, then print
Dear [first]
For example: "Dear Mary,"
- If the first name field is "unknown", then print
Dear Customer,
- If both the first name field is blank, then print
Dear Customer,
How do I code this in my template?
Answer
In versions 8.2 and later, the following code will check your contact's data and then print the saluation:
Dear %%if first = "unknown" then print "Customer" else if first = "" then print "Customer" else printdata first%%,<br />
The code breaks down as follows:
- Print "Dear "
- If the first name is the string "unknown", then print "Customer"
- Else, if the first name is blank, then print "Customer"
- Else, print the first name
- Print ","
For earlier releases that do not support nested if/then/else use:
Dear %%if first = "unknown" then print "Customer<!--"%%%%if first != "" then printdata first else print "Customer"%%%%if first = "unknown" then print "-->"%%, <br />