Skip to content

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.

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 (contactLists and contactIlsLists)
  • Campaign association — the campaign group the email belongs to
  • Images — all images embedded in the email body, extracted using 7 distinct URL patterns

JetStack AI supports all HubSpot email types:

TypeDescription
RegularStandard one-time marketing emails
A/B testEmails with two variants for split testing
AutomatedEmails sent by workflows (not manually triggered)
RSSEmails triggered by RSS feed updates
BlogEmails triggered by blog post publications

Each type has different state handling and deploy behavior, but the core remapping logic is shared.

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
  • ListscontactLists (inclusion) and contactIlsLists (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

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 ID

If 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.

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

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.

Emails with list-based targeting include two arrays:

  • contactLists — lists whose members should receive the email
  • contactIlsLists — lists whose members should be excluded

Both arrays are remapped to the corresponding destination list IDs.

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.

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.

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.

After creating an email, the campaign group ID may not be available in the immediate API response. JetStack AI handles this by:

  1. Creating the email
  2. Querying the email’s campaign association endpoint
  3. 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.

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.

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

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.