Hi, @a_funs Thanks for your question. The short answer is yes you can. It might look like this (simple example):
{% if contact.membership_type == "member" %}
<p>Say some member stuff</p>
{% endif %}
If you want a quick way to test this out, you can:
Navigate to the Design Manager
File
New File
HTML + HubL
Email template
and experiment from there.
If you build something out, and it won’t work as expected, adding your example here as a code block helps the community better understand the issue. And I can try inviting some community members to join us as well.
Yes, HubL can be used in emails, but there’s an important difference between coded and drag-and-drop emails. If you’re using a custom coded email template created in Design Manager, you can add HubL conditions directly in the template code, such as {% if contact.membership_type == ""member"" %} ... {% endif %}.
For drag-and-drop emails created directly in the email editor, you generally wouldn’t add HubL directly into the email content. In that case, I’d recommend using HubSpot’s personalization or smart content features to show different content based on contact properties.
Also, make sure membership_type is the actual internal name of the contact property, and test the email with contacts that have different values before sending.
I hope this helps you out. Please mark it as Solution Accepted and Like to help another Community member.
This post was created with the assistance of AI tools