Emails
Marketing emails are a core HubSpot asset type with significant complexity. An email can reference templates, blogs, lists, subscription types, and template modules, while also containing embedded images and dynamic content. JetStack AI captures the full email definition and reconstructs it in the destination portal with all references remapped.
What JetStack AI Captures
Section titled “What JetStack AI Captures”During import, JetStack AI retrieves the complete email definition:
- Email metadata — name, subject line, sender details, email type, state, A/B test configuration
- Content body — the full HTML/HubL email body, including inline styles and module references
- Template configuration — which template the email is built on, including generated layout references
- Subscription type — the email’s subscription category (required for CAN-SPAM/GDPR compliance)
- List targeting — which lists receive the email (
contactListsandcontactIlsLists) - Campaign association — the campaign group the email belongs to
- Images — all images embedded in the email body, extracted using 7 distinct URL patterns
Email Types
Section titled “Email Types”JetStack AI supports all HubSpot email types:
| Type | Description |
|---|---|
| Regular | Standard one-time marketing emails |
| A/B test | Emails with two variants for split testing |
| Automated | Emails sent by workflows (not manually triggered) |
| RSS | Emails triggered by RSS feed updates |
| Blog | Emails triggered by blog post publications |
Each type has different state handling and deploy behavior, but the core remapping logic is shared.
Dependencies
Section titled “Dependencies”Emails reference several other asset types:
- Email templates — the template the email is built on (either a custom template or a generated layout)
- Blogs — blog emails reference a specific blog for content sourcing
- Workflows — automated emails are associated with the workflow that sends them
- Lists —
contactLists(inclusion) andcontactIlsLists(exclusion) define the send audience - Subscription types — every email requires a subscription type for compliance
- Template modules — custom modules referenced within the email’s HubL content
Deploy Remapping
Section titled “Deploy Remapping”Subscription Type Rebuild
Section titled “Subscription Type Rebuild”Every email must have a valid subscription type in the destination portal. JetStack AI remaps the subscription type using the v3 API structure:
subscriptionDetails.subscriptionId -> destination subscription type IDIf the source email’s subscription type does not have a mapping in the destination, the email will fail to deploy. Ensure subscription types are imported and mapped before deploying emails.
Template Path Remapping
Section titled “Template Path Remapping”Emails reference their template by path. JetStack AI handles two template scenarios:
- Custom templates — the template path is remapped to the destination template’s path after it has been deployed
- Generated layouts — emails using drag-and-drop editors store their layout at
generated_layouts/{id}.html. JetStack AI remaps the{id}portion to the destination email’s generated layout ID
Image Upload
Section titled “Image Upload”JetStack AI extracts images from the email body using 7 distinct URL patterns, covering:
- Standard
src="https://..."image references - Background image URLs in inline styles
- HubSpot file manager URLs (
f.hubspotusercontent*.net) - Protocol-relative image URLs (
//cdn2.hubspot.net/...) - Images within HubL module parameters
- Open Graph and social sharing image meta tags
- Featured/preview image URLs
Extracted images are uploaded to the destination portal’s file manager, and all references in the email body are rewritten to point to the new URLs.
List Targeting Remapping
Section titled “List Targeting Remapping”Emails with list-based targeting include two arrays:
contactLists— lists whose members should receive the emailcontactIlsLists— lists whose members should be excluded
Both arrays are remapped to the corresponding destination list IDs.
Campaign Group ID Aliasing
Section titled “Campaign Group ID Aliasing”Emails belong to campaign groups in HubSpot. When a new email is created in the destination portal, the campaign group ID is not returned immediately in the creation response. JetStack AI queries the email’s campaign data after creation to retrieve the campaign group ID, which is then stored for use by other assets (like lists) that reference the email by campaign group.
Edge Cases and Special Handling
Section titled “Edge Cases and Special Handling”A/B Email State Handling
Section titled “A/B Email State Handling”A/B test emails use special states that differ from standard emails:
DRAFT_AB— an A/B email still in draft (both variants editable)AUTOMATED_DRAFT— an automated A/B email in draft state
JetStack AI preserves the A/B state and deploys both variants. The email is always deployed in a draft state regardless of its source state — it is never auto-published.
Generated Layout Path Remapping
Section titled “Generated Layout Path Remapping”Emails built with the drag-and-drop editor use a path format of generated_layouts/{contentId}.html. The {contentId} is the source email’s ID, which will differ in the destination. JetStack AI updates this path to reference the newly created destination email’s ID after creation. This is a post-creation patch operation.
Campaign Group ID Timing
Section titled “Campaign Group ID Timing”After creating an email, the campaign group ID may not be available in the immediate API response. JetStack AI handles this by:
- Creating the email
- Querying the email’s campaign association endpoint
- Storing the resolved campaign group ID for downstream use
If the campaign group ID cannot be resolved (rare, typically a HubSpot API delay), JetStack AI retries the resolution up to 3 times with backoff.
Troubleshooting
Section titled “Troubleshooting”Subscription Type Not Found
Section titled “Subscription Type Not Found”If an email fails to deploy with a subscription type error, verify that the subscription type from the source portal has been imported and mapped to a destination subscription type. Subscription types must exist before emails that reference them.
Images Not Displaying
Section titled “Images Not Displaying”If images appear broken in the deployed email, check the deploy log for image upload failures. Common causes include:
- Source image URLs that have expired or been deleted
- File size limits in the destination portal’s file manager
- Protocol-relative URLs that could not be resolved
Template Not Found
Section titled “Template Not Found”If the email’s template was not included in the import, the email cannot be deployed. Ensure all email templates (including generated layouts) are part of the import selection. Check the dependency tree in the import review step to verify template inclusion.