How to Replace First Name with Default Text If It Doesn’t Exist in HubSpot Emails


I recently was trying to send an email to a list containing different contacts but some did not have the First Name field filled in and was blank. So I did some google searches for a solution and came across these two posts: HubSpot forum topic and HubSpot forum topic 2.

I tried the code shared in the posts and they must be outdated because they did not work for me. I wrote a cleaner version below that checks if the first name field has content and if so display the name. If the field is blank use some default text.

The Code

{% if contact.firstname %}Dear {{ contact.firstname }},{% else %}Dear Customer,{% endif %}

What the code does

“Dear First Name,” OR “Dear Customer,”


Written by: Jake Lett
Jake Lett is a results-driven B2B marketing consultant with 15+ years of experience helping businesses boost online visibility, generate qualified leads, and increase sales. Specializing in SEO, HubSpot, and PPC campaign management, Jake leverages proven strategies to deliver measurable growth. As a Certified Google Ads Specialist and HubSpot Developer, he is committed to driving impactful results for his clients.

Topic:

Related posts

Tags: , ,

Want to Get Email Updates of New Articles?

Join My Email Newsletter