HubSpot Ideas


if statements in email templates

I want to ask HubSpot to support if statements in email templates as soon as possible.

It would be a really big help in providing customized content to our potential customers in our emails.


We currently support 7 languages.


Currently, all the personalization has to be done in either 7 different templates for the languages, or in the 7 email itself and by the help of many lists.


You can guess that for example to support different languages or countries, you would have to create really a lot of emails and lists to provide such personalization, even though we could access it over properties very easily. If we could compare these properties.


Many thanks for your suggestions to ease this process.

42 Replies

Having the same issue! That's actually a must-have!


Being able to have "IF"conditions  would be so useful!!! Please implement this feature soon!


That's such an important feature to keep things simpler! Just think about German or Spanish salutations where the greeting changes depending on a female/male recipient...

Top Contributor | Diamond Partner

Yeah, this is a massive bottleneck for emails that may need more customization than just simple rich-text blocks.


I understand there are technical issues/challenges w/ adding this functionality - but it's definately needed sooner rather than later.

Top Contributor

+1!!! This is such an important feature, and would be a lot less work than the current alternatives of multiple emails and/or smart content.


It would be a great help especially for the languages like german, where you have salutations based on gender. Please go for it! Thank's a lot.


@Roger : Yes, this is one of our problems with the languages. Currently, we greet with "Guten Tag XX,", where XX is the first name. We only do this because more fitting solutions would be way too complicated for our newsletter.

But for germans, this is a very rude way of speaking, especially if there is no first name and the greeting is only "Guten Tag ," (remark the useless space in front of the comma here), which is totally not a normal greeting term without a following name in german.


The "perfect" solution would be if we could greet based on a gender setting.

For example for mister/miss "Meier it would be "Guten Tag Herr Meier," or "Guten Tag Frau Meier," respectively. And there would be a fitting option for missing gender settings, too. It would be way more polite!


I have this issue with needing to send different images to different customers, so an if statement would be primo! (That or a smart content setting for the image block.)


It would be handy to add proprieties dynamically with the use of "If statement" across mailing. HubSpot please implement it!

Top Contributor

I would like to add another use case. We will be capturing the airport code that a traveller would like to travel from, such as YVR (Vancouver, Canada). I'd like to do something like:


If airport code equals YVR, set airport name to Vancouver

Else if airport code equals YEG, set airport name to Edmonton

etc etc.


And then be able to spit out the airport name in the email. However, this doesn't work because of the current limitations with contact properties and if statements.


This is pretty common programming, and it's available in other ESPs. Would love to see HubSpot implement this for email, it would really open up a lot of possibilities.


We're talking about {% if %} statements in HubL, right? Is this limitation documented somewhere? 


I wonder if this is just one manifestation of a more general limitation. 


I've been fighting for the last day and a half to get expressions working in {% for %} and {% set %} statements. These expressions use properties of the built-in contact variable, like what you're describing in this Slack thread:


Courtney Fantinato

Is there any information on when contact properties/variables will be supported in if statements for email? Was trying to store a contact property value in a variable to then use in an if statement to set the value of a new variable (i.e. if airport code = YVR, set airport name to Vancouver), and realized it wasn't working because if statements aren't supported in email with contact variables. 


Jon McLaren
Hi Courtney, totally understand the frustration and see the use case here. Its a known issue, and it is being looked into, Unfortunately there is no timeframe to disclose at this time.

 It's not working for me. HubL just doesn't seem to be able to evaluate the expression when it occurs inside the statement. I have described the issue in a community post here, and on the Slack channel here and here.


Could the issue with {% if %} statements possibly be a more general issue with contact properties inside statements?








The limitation can be seen on the official documentation for if statements in hubl.


I see that "Courtney Fantinato" from this slack thread seems to need if-statements for emails, too. @ridingforlife  seems to have a quite similar problem that is mentioned in this thread.


There could be more problems with the combination of emails and contact properties, but I don't know much about these.  I have also seen that Hubspot seems to have problem with {% set %} and contact properties, but I did not dig into it yet.


The if statement seemed more crucial to me, so I only focused on that problem in this idea.

Top Contributor

Courtney and myself are the same person 😉 


Aaah Haha, that explains why it was written so similarly Smiley LOL


That then leaves my statement to be only:

The limitation can be seen on the official documentation. And I have experienced problems with {% set %}, too, but did not dig into it.


Huge +1 for this one! Another use case to add to the list:


We have people who submit data and electronic forms (a ton of them over the course of several months) to apply to be foster parents. Some members of our team currently email these applicants reminders with the ongoing list of what they have submitted and a list of what still needs to be submitted.


I want to create the properties in HubSpot, then have a template that says:


Here's the list of things you've submitted

[Insert all items from this property group with "yes" answers]


Here's the list of what else you need to submit

[Insert all items from this property group with "no" answers]


Hopefully that makes sense and hopefully HubSpot jumps on this soon because it would be an enormous, enormous help.






I now need to create several templates to cover the correct salutation based on gender and formality. After all, it is also error-prone if someone uses the wrong model.





We'd like to have it as well... we lost a lot of effort to customize an email according to the gender of the contact


We are also looking for this, seems like a pretty obvious thing to have. 


Our client wants to kill their current email marketing software to have everything centralized in HubSpot, but the lack of IF statements in an e-mail are keeping us from doing so. The workaround is to make so many lists and emails which isn't something to maintain quite well.


Please add this feature to e-mails +1