Last modified: August 22, 2025
This feature is currently in beta. By using this functionality you agree to the developer beta terms. This guide refers to functionality available only through that beta. Opt-into the beta in your templates or modules.
- If you have a Marketing Hub Professional subscription, you can use data from standard CRM objects, such as contacts, companies, and products.
- If you have a Marketing Hub Enterprise subscription, you can also use structured data sources such as HubDB tables and custom objects. This data can be filtered based on the contact properties of the recipient.
Email sending limits
You can include the crm_object, crm_objects, and crm_associations CRM HubL functions in a programmable email, but any email that includes these specific functions are subject to the following limits that are based on the number of recipients you’re sending to:500,000 | 1 |
250,000 | 2 |
165,000 | 3 |
125,000 | 4 |
100,000 | 5 |
- If you clone a programmable email, it cannot be sent while the original is still in a processing state. You should wait at least 1 hour between each email send.
- You cannot conduct an A/B test for a programmable email that includes a
crm_object
,crm_objects
, orcrm_associations
HubL function. Emails sent using these functions have significantly slower send times than other emails, which can produce inaccurate test results.
1
Create a programmable email module
To create the email module to access your HubDB or custom object data:
With the module created, you’ll then add code to access data from your CRM. The following examples below demonstrate how to query from different data sources.To filter the data returned for each recipient, you can add a To filter the data returned for each recipient, you can add a
- In your HubSpot account, navigate to Marketing > Files and Templates > Design Tools.
- In the upper left, click File, then select New file.
- In the dialog box, select Module for the file type, then click Next. Then, select the Emails checkbox and enter a name for the file.
- Click Create.
-
To enable programmable email for the module:
- In the inspector on the right, toggle the Enable module for programmable email beta switch on.

- You can also enable programmable email for a coded email template by adding
isEnabledForEmailV3Rendering: true
to the top of the file.

Standard objects
You can use the HubL functions such as crm_object, crm_objects, and crm_associations to query data from standard objects in your account, such as contacts, companies, or products.The code below uses thecrm_object
HubL function to query the data from a product with an ID of 2444498793
and render the name, description, and price:Custom objects
If you have a Marketing Hub Enterprise account, you can query data from a custom object you’ve created in your account.The code below retrieves data from a custom object named Property, returning values (e.g. location, price) stored in the custom object’s properties.Note that the example below uses the custom object’s fully qualified name as the first argument when invoking thecrm_objects
HubL function.- The fully qualified name begins with the HubSpot account ID (prefixed by
p
), followed by an underscore and the lower-cased plural name of the custom object (e.g.,properties
). - You can retrieve an object’s
fullyQualifiedName
by making aGET
request to the CRM Objects schema API.
Please note:If the name of your custom object contains hyphens (e.g., My-Custom-Object), its properties can not be rendered in a programmable email. You can recreate the custom object with the hyphens omitted directly in your HubSpot account, or you can use the custom object API.
query
parameter, which will filter the results by the recipient’s contact properties. View the full list of filter options.HubDB
If you have a Marketing Hub Enterprise account, you can use data from a HubDB table in your email.The code below uses thehubdb_table_rows
HubL function to retrieve all data from the table. This will list all the real estate properties in the email, outputting the details of each property along with their image.query
parameter, which will filter results by the specified contact properties. View the full list of filter options.In the above example, the contact property Budget max is referenced with
contact.budget_max
, while Persona is referenced with contact.hs_persona.value
. This is because Persona is an enumeration property, which requires an additional .value
to parse the property’s value, while other property types do not.2
Add the module to an email
With the module published, you’ll now add it to the body of the drag and drop email.
If you’ve set up the module to filter data by specific contact properties, the email preview will appear blank. This is because the email tool hasn’t been set to preview the email by a specific contact.To preview what the email will look like for a specific contact:
You should now see only the data relevant to the recipient, filtered by their contact properties.
If an email template or module contains custom code with unresolved HubL, a placeholder module will appear in its place.
- In your HubSpot account, navigate to Marketing > Email.
- Select the email that you created.
- In the left sidebar, under Content, click More. Find your programmable email module, then drag it into the email body.

- In the upper right, click Actions, then select Preview.

- On the next screen, click the Preview as a specific contact dropdown menu, then select a contact.



It’s important to always have fallback data to send in the case that there are no HubDB rows or custom object records that meet the criteria you’ve set. Otherwise, the recipient might receive a blank email.This beta may cause issues with existing templates. It’s important to test any changes thoroughly before publishing and sending a live email.
More HubDB focused tutorials
- Building dynamic pages with HubDB
- How to join multiple HubDB tables
- How to build a dynamic team member page with HubDB
- How to build multilevel dynamic pages using HubDB