Personalizing the Subject Line of an email is a great way to make your emails attract immediate attention.

In Maropost, you can personalize your subject lines and write a custom liquid script to print custom values in the subject line.


In this example, we will show you how to print a contact’s name to personalize the subject line.


 

Since it is possible that there might be a number of contacts who do not have their first names saved in your Maropost Account, we need to make sure that those contacts who have their first names saved in the account are shown their respective names in the email, and the contacts who do not have their first names saved in the account, are shown a custom word that will be valid for all the contacts, without the first names saved.


Using the liquid script below:


{% if contact.first_name != blank %}

{{contact.first_name}}

{% else %}

User

{% endif %}

Your Subject Line


In the aforementioned script, we are using the IF/ELSE condition to check if a contact has the first name value saved in the “contact first_name” custom field. If it does, we are printing the name of the contact, i.e printing the value of the custom fie” contact.first_name”. The ELSE condition is used where the IF condition fails to find a value for “contact.first_name” for a contact, and prints a custom value (in the example above,” User”)


You can always modify and add more complexity to the code to fulfill your requirements.


Keep in mind, that the length of the subject line is 2000 characters so your liquid script should not exceed that limit.

Another way to achieve the same results is through the use of Custom Fields. Click here to know more about it.