Guide5 min read•Audience: Marketers, Developers
Using PostBrix with HubSpot
Create custom code email templates in HubSpot Design Manager, map HubL contact tokens, and meet CAN-SPAM requirements.
Key Takeaways
- In HubSpot Design Manager, create an HTML & HubL file and set the template type to "Email".
- Paste your compiled PostBrix HTML.
- Map personalization variables to HubL tokens: {{ contact.firstname }}.
- HubSpot requires standard footer tokens: {{ unsubscribe_link }} and {{ site_settings.company_street_address_1 }}.
Setting Up an Email Template in HubSpot#
- In HubSpot, navigate to Marketing → Files and Templates → Design Tools.
- Click File → New File → HTML & HubL.
- Choose Email as the template type.
- Replace the default template boilerplate with your PostBrix compiled HTML.
- Publish the file to make it available in the HubSpot Email Marketing tool.
HubSpot HubL Token Mapping#
HubSpot uses the HubL templating engine:
- First Name:
{{ contact.firstname }} - Last Name:
{{ contact.lastname }} - Email:
{{ contact.email }} - Company Name:
{{ contact.company }} - Unsubscribe Link:
{{ unsubscribe_link }} - Subscription Preferences:
{{ unsubscribe_link_all }} - Company Address:
{{ site_settings.company_name }}, {{ site_settings.company_street_address_1 }}
Frequently Asked Questions
Why does HubSpot give an error when publishing my custom HTML email?
HubSpot mandates the presence of CAN-SPAM tokens. You must include {{ unsubscribe_link }} and company address tokens (like {{ site_settings.company_street_address_1 }}) in your template footer.
Can marketers edit text in HubSpot without touching code?
If you wrap sections in HubL module tags ({% email_each %}), marketers can edit text. Otherwise, we recommend updating the design in PostBrix and re-pasting the compiled HTML.