pelago/emogrifier
Emogrifier converts CSS styles into inline style attributes in your HTML, ensuring reliable display in email clients and mobile readers that lack stylesheet support. Useful for Outlook 2007 and Gmail quirks. Install via Composer: pelago/emogrifier.
thecodingmachine/safe), shrinking our dependency surface and audit burden.render() now throws on internal DOMDocument errors instead of returning an empty string. Previously a failure could ship a blank email; now it fails loudly, which is safer for transactional mail but requires error handling in our send pipeline.trigger_error() and returns the original HTML/CSS unmodified rather than throwing (exception only when the debug option is set). Product implication: a malformed template can silently send un-inlined email in production. We must pair this with alerting on trigger_error / log monitoring, not assume "no exception = correct rendering."Adopt if:
Look elsewhere if:
render() on malformed HTML — v8.3.0 converted silent empty-string failures into thrown errors; that's the right default, but it needs a try/catch and a fallback path (or a dead-letter queue) before rollout.For Executives: "Emogrifier solves a critical pain point in our email infrastructure: inconsistent rendering across clients. By inlining CSS, we ensure our transactional emails (e.g., invoices, notifications) and marketing campaigns display perfectly—whether opened in Outlook 2007 or the latest iPhone Mail app. This reduces support tickets, improves brand consistency, and future-proofs our communications. The newly released v8.3.0 strengthens the risk case: it adds PHP 8.6 support (we won't be stranded on an unsupported runtime), removes a third-party runtime dependency (smaller supply-chain surface), and fixes a memory build-up issue in long-running processes, which matters as we scale batch sends. It also stops emitting blank emails on internal parse failures. MIT license, active maintenance, and Laravel-native integration make this a low-risk, high-reward choice. The one operational ask is monitoring: production now degrades gracefully instead of throwing when a regex fails, so we'll alert on those events rather than discover broken styling from customer complaints."
For Engineering: *"This package replaces manual CSS-inlining hacks with a battle-tested, Laravel-native solution. v8.3.0 specifics you should know before bumping:
render() now throws on internal DOMDocument errors instead of returning ''. Audit any caller that relied on an empty string; wrap sends in try/catch so a bad template doesn't take down a queue worker.trigger_error() + original string returned; exception only when the debug option is set. This restores 8.1.0 behavior. Wire your log/error handler so it's observable, and enable debug in staging to keep fail-fast tests.sabberworm/php-css-parser >= 9.5.0; thecodingmachine/safe is gone from runtime (still dev-only for tests).HtmlPruner, CssVariableEvaluator) for post-inlining cleanup.trigger_error, before rolling out to all email features."For Design/Marketing: *"No more ‘it looks broken in Outlook’ emails! Emogrifier ensures your templates render exactly as designed across all clients. This means:
CssToAttributeConverter—it even converts style="width: 100px" to <width="100"> for ultra-legacy clients!"How can I help you explore Laravel packages today?