How to Export HTML Emails to Mailchimp, HubSpot, and Klaviyo
The Custom HTML Email Workflow
If you build custom HTML emails — rather than using your ESP's visual drag-and-drop builder — you'll need to export your finished HTML into your sending platform. Each major ESP handles custom HTML differently, with different import interfaces, different levels of support for modern HTML, and different ways they process your code before sending.
This guide covers the specific steps for the three most widely used ESPs — Mailchimp, HubSpot, and Klaviyo — along with the common issues you'll encounter and how to solve them.
Before You Export: Prepare Your HTML
Regardless of which ESP you're importing into, do these steps first:
1. Inline Your CSS
Most ESPs apply their own CSS processing when you import HTML, and they often strip <style> block content or handle it inconsistently. Inline your CSS before importing to ensure your styles survive the import process unchanged. Tools like Postdrop.io inline CSS automatically — export the inlined version for importing into your ESP.
2. Host Your Images
Image URLs in your HTML must be absolute URLs pointing to a hosted image (not relative paths or base64-encoded strings). Most ESPs will upload your images to their CDN during import, but some need them pre-hosted. The safest approach: host images on your own CDN or image hosting service before importing, so the URLs remain stable regardless of how your ESP processes the import.
3. Test Your Email First
Use Postdrop.io or a similar tool to verify cross-client rendering of your HTML before importing. Once you're inside an ESP's editor, making substantial HTML changes is more difficult. Catch rendering issues at the HTML level, not after import.
4. Add Merge Tags
Each ESP uses its own template merge tag syntax for personalization (first name, etc.). If your email uses personalization, add the correct merge tags for your target ESP before importing. See the ESP-specific sections below for the correct syntax.
Importing into Mailchimp
Classic Builder vs. New Builder
Mailchimp has two email builders — the Classic Builder and the newer drag-and-drop builder. Custom HTML import behaves differently in each:
Classic Builder: When creating a new campaign, choose "Code Your Own" from the template selection screen. This opens a full HTML editor where you paste your code directly. The Classic Builder preserves your HTML with minimal processing, making it the preferred option for custom-coded emails.
New Builder: The new builder is designed for visual editing and is less suited to custom HTML. It wraps your HTML in its own layout structure, which can interfere with your template's design. Stick to the Classic Builder for custom HTML templates.
Mailchimp Merge Tags
Mailchimp uses *|FNAME|* syntax for merge tags:
<p>Hi *|FNAME|*, ...</p>
Other common tags: *|EMAIL|* (subscriber email), *|UNSUB|* (unsubscribe link — required by law).
Mailchimp-Specific Processing
Mailchimp automatically adds tracking parameters to links. It also requires an unsubscribe link in the email footer. If your HTML doesn't include one, Mailchimp will add it — potentially in an ugly default style that clashes with your design. Include a styled unsubscribe link in your template before importing: <a href="*|UNSUB|*">Unsubscribe</a>.
Importing into HubSpot
Creating a Custom HTML Email in HubSpot
HubSpot handles custom HTML emails through its email editor. When creating a new email, choose the "Drag and drop" editor, then look for the option to "Edit HTML source" or switch to the HTML editor. In older versions of HubSpot, select a "Custom" template type, which gives you direct HTML access.
Alternatively, HubSpot supports custom template modules — reusable HTML email templates stored in the Design Manager. This is the more powerful approach for teams who send many emails using the same template. Upload your HTML template to the Design Manager, then use it as the base for campaigns.
HubSpot Merge Tags
HubSpot uses its own HubL templating language for personalization:
<p>Hi {{ contact.firstname }}, ...</p>
Other tokens: {{ contact.email }}, {{ unsubscribe_link }}.
HubSpot CSS Handling
HubSpot processes CSS differently than raw import. It applies its own email reset styles that can conflict with your custom styles. Inline all CSS before importing. Pay particular attention to font declarations — HubSpot's default font stack may override yours if you rely on <style> block font rules.
Importing into Klaviyo
The HTML Block Approach
Klaviyo's email editor uses a block-based structure. For custom HTML, use the "Custom HTML" block type in the email builder. This embeds your custom HTML within Klaviyo's email wrapper. For full control over the entire email structure, use a "Full HTML" template instead, which gives you complete control over the email's HTML without Klaviyo's wrapper.
To create a Full HTML template: go to Templates in Klaviyo, click "Create Template," and choose "HTML Editor." Paste your full HTML here. This is the cleanest approach for completely custom templates.
Klaviyo Merge Tags
Klaviyo uses Django template syntax:
<p>Hi {{ first_name }}, ...</p>
Built-in variables: {{ email }}, {{ unsubscribe_url }}.
Klaviyo Image Hosting
Klaviyo automatically uploads and re-hosts any images with relative paths or URLs it can't access. For reliable image delivery, host your images on your own CDN and reference them with absolute HTTPS URLs. Klaviyo also offers its own image library where you can upload assets to keep them accessible across templates.
Common Import Issues and Fixes
Styles Get Stripped
If your styles disappear after import, the ESP likely stripped your <style> block. Inline your CSS before importing. This solves 90% of style-stripping issues.
Images Break After Import
Broken images after import usually mean either: the image URL was relative (not absolute), the image host blocked the ESP's CDN from fetching it, or the image was embedded as a base64 string that the ESP didn't handle correctly. Use absolute HTTPS URLs pointing to publicly accessible images.
Layout Looks Different in the ESP Preview
ESPs add their own wrapper HTML around your template, which can affect layout. Test with a real send (to a test address) rather than relying solely on the ESP's preview tool. The send is always the most accurate representation of what subscribers will see.
Tracking Links Break Your HTML
ESPs wrap all links with tracking redirects. This can sometimes introduce encoding issues or break special characters in URLs. Always send a test before the actual campaign and click every link to confirm they redirect correctly.
Building and testing your email in Postdrop.io before importing gives you a clean, tested HTML baseline. Export the fully inlined HTML, add your ESP's merge tags, then import — this workflow minimizes import-time surprises and keeps your source files separate from your ESP's processing.