Emogrifier

screenshot of Emogrifier

Converts CSS styles into inline style attributes in your HTML code.

Overview

Emogrifier is an essential tool for any developer working with HTML emails, especially when it comes to dealing with the inconsistencies of different email clients. This utility is designed to convert CSS styles into inline style attributes within the HTML code, ensuring proper display across various email readers and mobile devices that often lack support for external stylesheets. With its origins rooted in addressing the challenges posed by notorious email clients like Outlook and GoogleMail, Emogrifier stands out as a practical solution for optimizing the presentation of HTML emails.

The ongoing struggle for web developers to achieve consistent styling in emails is met head-on by Emogrifier's ability to 'transmogrify' HTML effortlessly. By parsing CSS and inserting definitions directly into HTML tags, developers can improve the reliability of their emails' visual appearance, sidestepping the limitations imposed by different email platforms.

Features

  • Inline CSS Conversion: Automatically converts CSS styles into inline style attributes for reliable email rendering.
  • DocType Normalization: Adds a document type declaration (HTML5) if missing, ensuring compatibility with modern HTML standards.
  • HTML Structure Correction: Corrects improperly nested tags and can add missing HEAD and BODY elements to the HTML.
  • Customizable Inlining Process: Allows modifications to the inlining process through various available options, enhancing flexibility for developers.
  • Support for Body Content: Offers a method to retrieve only the content of the body element, which is useful when needing to extract specific parts of the email.
  • Multiple HTML Processing Classes: Provides subclasses for further HTML manipulation after inlining CSS, giving developers more control over their email design.
  • User-Friendly Installation: Easily installable via Composer, making it accessible for integration into various projects.