How are HTML Fragments Useful?

These fragments offer a way for marketers to send only the necessary code for a specific part of an email, such as the header section which may include a logo, navigation, and introductory text. Fragements can be an entire email or a small snippet of code, that you will embed as HTML in a larger email template builder such as beefree.

Furthermore, HTML fragments can be reused across different emails, saving time for marketers and creating consistency across their campaigns. These fragments are considered as sections of an email campaign and will not contain <html> or <body> tags as they are partial sections. Templates are widely used in email marketing, with each section of the template being considered as a fragment.

When creating new emails, any new content that is inserted into a template is also referred to as a fragment.

Examples of HTML Fragments

HMTL Fragment


HTML Template


At line 16, there’s a prompt suggesting the insertion of the tailored content segment at that point in the HTML. This serves merely as a guide; the actual process for incorporating HTML fragment can vary based on the email template system you are using.

Exporting your HTML from the template tool, refining it with a campaign cleaner, and then dispatching it as raw HTML is the preferred procedure. While template builders are excellent for crafting emails swiftly, the HTML generated is not always streamlined. They maintain a specific structure to ensure compatibility with the template system’s functionality.

Campaign Cleaner was initially developed to optimize large fragments, but it does an excellent job optimizing the entire email.

HTML Fragment Use Case

A company utilizes HTML fragments in its email campaigns to streamline the creation process and ensure consistency across different messages. They encounter challenges with email performance, such as rendering issues, slow load times, and potential spam filtering due to non-optimized content.

To address these issues, the company turns to Campaign Cleaner, which offers a comprehensive optimization toolset. Campaign Cleaner enhances the email campaigns by:

Optimizing images: It resizes, converts, and hosts images on a CDN for faster loading.

Previewing inboxes: It previews how emails will appear across different clients and devices.

Managing preheaders and fonts: It adjusts preheader text and font colors to prevent triggering spam filters.

Checking links: It validates hyperlinks to prevent broken links and spam flagging.

Sanitizing HTML: It ensures emails display consistently by removing unsupported HTML and JavaScript.

Compressing HTML: It reduces email size for faster loading.

With Campaign Cleaner, the company’s HTML fragments are refined, leading to emails that are more likely to be delivered, opened, and acted upon by recipients. This results in improved engagement, better deliverability, and a higher return on investment for their email marketing campaigns.