How to Use a Custom HTML Email in Shopify Messaging (Shopify Email)
How to send your own HTML email from Shopify Messaging, formerly Shopify Email, in campaigns and abandoned cart automations, and stay under its size limits.
Shopify Messaging, formerly known as Shopify Email, builds emails from its own sections. Plenty of stores already have a designed email, though, and want to send that for their email marketing instead. There are two ways to do it. You can code the whole email with Code your own, or paste your HTML into a Custom Liquid section.
The short answer: Code your own takes up to 500 KB, and Shopify documents it for campaigns. The Custom Liquid section takes 50 KB, and it is the route that works in automations: I tested a full HTML email in one in an abandoned cart automation. So an automation email in your own HTML has to fit in 50 KB. This post is about marketing emails in the Messaging app. Order confirmations and shipping updates are not covered here. You edit those under Settings > Notifications.
- There are two routes. Code your own is a whole coded email of up to 500 KB, documented for campaigns. A Custom Liquid section holds up to 50 KB and sits inside the section editor of a template email, campaign or automation.
- For automations, use the Custom Liquid section. I tested a full HTML email in one section of an abandoned cart automation, and it worked. You need a desktop to set it up.
- Every coded email needs an unsubscribe tag. That is
{{ unsubscribe_link }}or{{ unsubscribe_url }}, plus the open tracking tag if open tracking is on. - The cart link depends on the automation. It is
{{ abandoned_visit.url }}in abandoned cart and browse, and{{ abandoned_checkout.url }}in abandoned checkout. Outside its own automation the link is empty, and a test send may not fill it either. Give it a default link. - 50 KB is bytes, not characters. Link images instead of embedding them, inline only the styles you use, and strip comments and indentation.
- Gmail is the second limit. Email vendors report that it clips emails over about 102 KB of HTML, so even a 500 KB campaign should stay small.
- Set background colors in style attributes. In my test, Shopify removed the
bgcolorattributes from the pasted HTML.
Where custom HTML works in Shopify Messaging
Shopify's custom Liquid page gives two ways to add your own HTML. That HTML can come from a designer or an ecommerce email generator. You can create a whole email with Code your own when you create a campaign. Or you can add a Custom Liquid section to an email built from a template.
| Route | Where you add it | Size limit | Campaigns | Automations | Tags to include |
|---|---|---|---|---|---|
| Code your own | Create message, then Code your own | 500 KB | ✓ | Not documented | Unsubscribe, plus open tracking if it is on |
| Custom Liquid section | A section in a template email's editor, on a desktop | 50 KB | ✓ | ✓ | Unsubscribe, when your HTML is the whole email |
The ✓ for Custom Liquid in automations is from my test of an abandoned cart automation. The size limits are what decide the route. Shopify allows 500 KB for a custom-coded email and 50 KB for a Custom Liquid section. If your email lands between the two, it fits a campaign through Code your own. It does not fit a Custom Liquid section, which is the route I tested for automations.
How to send a custom HTML email as a Shopify Messaging campaign
A campaign is the easy case. You get the whole 500 KB and no template around your code.
Check the tags before you paste. Shopify requires one of two in a custom Liquid email: unsubscribe_link or unsubscribe_url. Put {{ unsubscribe_url }} inside your own link, as the footer below does: <a href="{{ unsubscribe_url }}">Unsubscribe</a>. If open tracking is on, the open tracking variable is required too. Shopify's text calls it open_tracking, but its own code examples use {{ open_tracking_block }}, so the footer uses that form.
The footer holds your store's postal address and the unsubscribe link. Put it just above </body>:
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td style="padding:24px;font-family:Arial,sans-serif;font-size:13px;color:#666666;text-align:center;">
{{ shop.name }}, {{ shop.address.address1 }}, {{ shop.address.city }} {{ shop.address.zip }}, {{ shop.address.country }}<br>
<a href="{{ unsubscribe_url }}" style="color:#666666;">Unsubscribe</a>
</td>
</tr>
</table>
{{ open_tracking_block }}
Then create the campaign:
- From your Shopify admin, go to Apps > Messaging and click Create message.
- Select Code your own.
- If the HTML came from another email tool, replace that tool's tags first. Mailchimp's
*|UNSUB|*, for example, becomes{{ unsubscribe_url }}, and*|FNAME|*becomes{{ customer.first_name }}. - Paste your code into the editor. Or click Import to load a file from your computer. Imported files must be .html.
- Search the code for
unsubscribeto confirm the footer is there. - Click Send test and enter up to 5 email addresses, one at a time.
- Add the subject line and preview text, choose who gets the email, then send it or schedule it.
Shopify's own screenshot from the Shopify Messaging App Store listing: a coded email in the Code panel, next to emails built from templates.
Email vendors report that Gmail clips emails over about 102 KB of HTML. So keep a campaign under about 100 KB, not 500 KB.
How to use custom HTML in a Shopify Messaging automation
Automation emails use the same section editor as campaign templates. Since March 24, 2026, automations that use Messaging emails live in the Shopify Messaging app. Older guides that send you to Marketing > Automations are out of date.
Another screenshot from the same listing: a welcome automation that sends a marketing email when a customer subscribes. Its email opens in the same section editor.
Shopify documents Code your own only for campaigns. So the route I tested for automations is the Custom Liquid section:
- On a desktop, go to Apps > Messaging > Automations. Editing an automation's template needs a desktop device.
- Click Create automation, choose a template such as Recover abandoned cart, and in the dialog select Email as the channel.
- Click Edit email.
- Add a section and choose Custom Liquid.
- Remove the template's other sections (header, text, product and button), so your Custom Liquid section is the email. The footer section can't be removed, and it already shows your store's details. So leave the address out of your own HTML, and if the footer already has an unsubscribe link, leave yours out too, so the email doesn't end with two.
- Replace another tool's tags, as in the campaign steps above, then paste your HTML. It must be under 50 KB, so check the size first (see the size section below).
- Set the subject line, then click Send test. The test may not have a real cart in it. So the product list can come out empty, and the cart link can show your default.
- Click Turn on, or Save without turning on.
To change an automation you already have, open its actions menu and click Edit. Add the section as in steps 4 to 6, then click Save and Exit. To see the email with a real cart in it, turn the automation on and leave a cart on your own store as a customer.
What I saw. I tested this on a live Shopify store in November 2026. A full HTML email went into one Custom Liquid section of an abandoned cart automation, and it worked. Shopify documents the Custom Liquid section, but not a whole email inside one. One thing changed on the way: Shopify removed the bgcolor attributes from the pasted HTML. Set every background color in a style attribute as well, like style="background-color:#f6f1ea;".
The recovery group has three templates: Convert abandoned product browse, Recover abandoned cart and Recover abandoned checkout. Each one supports email, SMS and WhatsApp. These emails only reach people who got as far as a product. If most visitors leave before that, the problem is the one behind ecommerce traffic not converting, and no cart email fixes it.
Liquid variables for custom HTML emails in Shopify
Only the variables Shopify lists as supported work in custom Liquid. Some fill in every email. The abandonment ones fill in only inside their own automation, and are empty everywhere else.
| Variable | What it fills in | Where it works |
|---|---|---|
{{ customer.first_name }} |
The customer's first name | Every email |
{{ shop.name }}, shop.address (address1, city, zip, country) |
Your store's name and postal address, for the footer | Every email |
{{ unsubscribe_url }} |
The address of the unsubscribe page | Every email |
all_products['handle'] |
A product from your store, by its handle: the last part of the product's URL | Every email |
{{ abandoned_visit.url }} |
The link back to the abandoned cart, or to the browsed page in a browse email | Abandoned cart and product browse |
abandoned_visit.products_added_to_cart |
The first five cart products, with title, image_url, variant_title and quantity | Abandoned cart and product browse |
abandoned_visit.products_viewed |
The first five products viewed, with title, description, image_url and url | Abandoned cart and product browse |
abandoned_visit.remaining_cart_products_count |
How many cart products come after the first five | Abandoned cart and product browse |
{{ abandoned_checkout.url }} |
The checkout link | Abandoned checkout |
abandoned_checkout.line_items |
The first five line items, with product_title, variant_title, quantity and image_url | Abandoned checkout |
Not every customer has a first name on file, so give it a fallback: Hi {{ customer.first_name | default: 'there' }},
The cart link. Use {{ abandoned_visit.url }} in abandoned cart and browse emails, and {{ abandoned_checkout.url }} in abandoned checkout. Outside its automation the variable is empty. That includes any campaign that reuses this HTML, and a test send may not fill it either. Give it a default:
<a href="{{ abandoned_visit.url | default: 'https://yourstore.com/products/your-product' }}">Back to your cart</a>
<a href="{{ abandoned_checkout.url | default: 'https://yourstore.com/cart' }}">Finish checkout</a>
Use the first line in an abandoned cart or browse email, and the second in an abandoned checkout email. Inside the automation, the reader goes back to their cart or checkout. In a campaign, and possibly in a test send, the link opens your default page instead of going nowhere.
The cart products. A loop lists what the customer left behind:
{% for item in abandoned_visit.products_added_to_cart %}
<p style="margin:0 0 8px;">{{ item.title }}, {{ item.variant_title }} x {{ item.quantity }}</p>
{% endfor %}
{% if abandoned_visit.remaining_cart_products_count > 0 %}
<p>And {{ abandoned_visit.remaining_cart_products_count }} more in your cart.</p>
{% endif %}
The titles come straight from your store, so a vague product title reads just as vague in the inbox. In our Shopify store statistics from 1,000 stores, about 1 in 7 product titles did not say what the product was.
Product images. Shopify's own example loads a product image like this:
<img src="https:{{ all_products['product-1-handle'] | image_url: width: 200 }}" width="200" height="200" alt="Product name">
Replace product-1-handle with your product's handle, the last part of the product's URL. For /products/linen-shirt, the handle is linen-shirt. Keep the https: in front of the Liquid tag, as Shopify's example does. An email image needs a full address to load, and that prefix is part of it. Write the product's name in the alt text.
That loads an image of the product from your store, normally the first one on the product. So the main image on your product page is usually the one the email shows.
How to keep an HTML email under 50 KB
The 50 KB counts the text of your HTML code, not the images it shows. An image you link to only adds its address to the code. So most of the work is cutting text out of the HTML. In order of what usually saves the most:
- Link hosted images, never embed them. A base64 image puts the whole file inside the code. One photo can use up the 50 KB alone. Base64 images also don't show in any Gmail client, and spam filters penalize them. Use full addresses that start with https://. A path like
src="images/hero.jpg"won't display in an inbox. To get a full address, upload the image to Files in your Shopify admin and copy its link. - Inline only the styles you use. Some email apps ignore
<style>blocks, which is why most campaigns inline their CSS. That means putting styles on each tag, like<td style="padding:16px;">. A free CSS inliner does this for you. Each style is then copied onto every tag that uses it. So remove the ones that change nothing, such asmargin:0on a tag that already has no margin. - Strip comments, indentation and empty lines. A minifier does this in one pass. Keep any comment that starts with
<!--[if mso]>, because Outlook needs it. Afterwards, check that every{{ }}and{% %}tag is still intact. - Merge repeated tables. If every row sits in its own nested table, one table with more rows does the same job in less code.
- Shorten the text and show fewer products. An email is not the place for the full product description. One or two lines and a button do the job. The cart variables only return the first five products anyway.
How to check the size. Save the code as an .html file. On a Mac, select it and choose File > Get Info. On Windows, right-click it and choose Properties. Read the exact byte count and keep it under 45,000 bytes, so a later edit doesn't push it over. Count bytes, not characters. A character counter counts "ç" as one, but in UTF-8 it takes 2 bytes. The same goes for ş, ğ, é, ã and Cyrillic letters, so the same email in Turkish or Russian is bigger than the English one.
Gmail clips emails over about 102 KB
Email vendors report that Gmail clips an email whose HTML is larger than about 102 KB. The number comes from them, not from Google. Gmail shows the top part with a "[Message clipped] View entire message" link, and the full email opens in a new window.
Clipping hits the bottom of the email, where two things sit. A clipped email can hide the unsubscribe link, and a reader who can't find it is more likely to mark the email as spam. The open tracking pixel at the end doesn't load either, unless the reader opens the full message.
Liquid makes the email grow after you send it. Gmail sees the email after Liquid has filled in, so a product loop takes more room in the inbox than in the editor.
For a campaign, 500 KB is Shopify's limit, but about 100 KB is the practical one.
How to test a custom HTML email before it goes out
Send a test from the campaign or the automation, and open it in more than one place:
- Gmail, on a computer and a phone. Check that nothing is clipped and the footer is there.
- Outlook for Windows. Classic Outlook for Windows, 2007 to 2019 and the Microsoft 365 desktop app, uses Word to draw emails. It ignores most widths and padding on
<div>tags, so lay out content in tables. It also needs width and height attributes on images, or it shows them at full size. No classic Outlook? A preview tool such as Litmus or Email on Acid can show it. Or ask someone who has it to open your test. - Your phone in dark mode. Switch it on and open the test again. Check that the logo, the text and the buttons are still readable. If a dark logo disappears, use a PNG with a light outline, or place the logo on a light box with its own background color.
- Every link. Click each button and check that it lands on the right product page, the cart or the checkout.
- The Liquid. Outside a real automation send,
abandoned_visitandabandoned_checkoutare empty. In a test send, those parts may come out blank or fall back to your default. The automation steps above show how to see a real cart.
Common custom HTML email problems in Shopify Messaging
- The unsubscribe tag is missing. A coded email needs
{{ unsubscribe_link }}or{{ unsubscribe_url }}. HTML from another email tool carries that tool's own unsubscribe tag, like Mailchimp's*|UNSUB|*. It is not a Shopify variable, and only supported variables work in custom Liquid, so replace it. - The Custom Liquid section is too large. The code can't exceed 50 KB. Work through the size steps above. If the email is for a campaign, Code your own gives you 500 KB.
- Background colors are gone. In my test, Shopify removed
bgcolorattributes. Setbackground-colorin a style attribute on the same element. - Images don't show. Check for relative paths and base64 images first. Background images are less reliable: Outlook for Windows needs VML to show them. Put anything that matters, such as product images, in an
<img>tag with alt text. - The layout breaks in Outlook. Move the layout from
<div>tags into tables, and give every image width and height attributes. - The cart link opens your default page in a campaign. That is the default doing its job.
abandoned_visit.urlis empty outside its automation. - The cart products are empty. Same cause. The products fill in only when the email goes out from the abandoned cart or browse automation.
- There is no Custom Liquid option on your phone. A Custom Liquid section can only be created on a desktop.
Which route to use for a custom HTML email
For a campaign, use Code your own and keep the HTML under about 100 KB. For an automation, use one Custom Liquid section and keep the code under 45,000 bytes. Either way, add the unsubscribe tag, set background colors in style attributes, and give the cart link a default. Then send a test to Gmail, Outlook and a phone before it reaches a customer.
Frequently asked questions
Can I use my own HTML email template in Shopify Messaging?
Yes. You can create a whole email with Code your own when you create a campaign, up to 500 KB. Or you can paste HTML into a Custom Liquid section in a template email's editor, up to 50 KB. A coded email needs {{ unsubscribe_link }} or {{ unsubscribe_url }}.
How do I import an HTML file into Shopify Email?
Go to Apps > Messaging, click Create message and select Code your own. Then click Import and choose your file. Imported files must be in .html format.
What is the size limit for custom HTML in Shopify Messaging?
A custom-coded email can be up to 500 KB, and a Custom Liquid section up to 50 KB. Email vendors report that Gmail clips emails with more than about 102 KB of HTML, so that is the practical limit for a campaign.
Can I use custom HTML in a Shopify abandoned cart email?
Yes, with a Custom Liquid section. I tested a full HTML email in one section of a Recover abandoned cart automation, and it worked. The code has to stay under 50 KB, and you need a desktop to add it. Use {{ abandoned_visit.url }} for the cart link.
Why are the cart products empty in my custom Shopify email?
The abandonment variables fill in only inside their own automation. abandoned_visit works in the abandoned cart and browse automations, and abandoned_checkout only in abandoned checkout. In a campaign they are empty, and a test send may not fill them either, so give links a default.
Is Shopify Messaging email free?
Every store on the Basic, Grow, Advanced and Plus plans gets 10,000 free emails at the start of each month. After that, it costs $1 per 1,000 emails up to 300,000, and less per 1,000 above that. Automation emails count toward the 10,000, but abandoned checkout emails are always free.