eduardokum/laravel-mail-auto-embed
Laravel package that automatically embeds images in outgoing mailables, turning remote or local image URLs into inline CID attachments so they render reliably in every email client—no manual attachment wiring or template changes required.
Architecture fit. laravel-mail-auto-embed is a deliberately narrow, single-purpose package: it hooks into Laravel's mail rendering pipeline to rewrite <img> references in outgoing HTML into inline CID attachments (and/or auto-resolve $message->embed()-style references). It registers a service provider, exposes a small config surface, and otherwise has no persistence, queue, or runtime footprint. For a Laravel-native stack this is a clean library-shaped dependency with negligible architectural surface.
Integration feasibility. Composer install plus service-provider auto-discovery is the entire happy path; a config publish is optional. It composes with Mailables, Notifications, and Markdown mail without changing sending code, which is the main reason to consider it over hand-rolled embed() calls.
Technical risk.
embed(), altered email weight, and possible interaction with Markdown/Blade compilation order.Key questions.
Stack fit. Best fit is a standard Laravel app sending transactional email where rendering fidelity matters (receipts, alerts, branded notifications) and recipients' clients block remote images. Poor fit if email must stay tiny, if a CDN already serves absolute image URLs, or if the team has a hardened, custom mail pipeline.
Migration path. Low-risk and reversible: composer require, optional config publish, enable behavior globally or per-mailable, ship behind a config/env flag. No schema, data, or API migration. Existing manual $message->embed() calls should be audited first to avoid double-embedding.
Compatibility. Confirm against the exact Laravel and PHP versions in use (note PHP version floors implied by recent Laravel releases). Check for collisions with any custom Mailer/Transport decorators, and test alongside the actual mail driver (SES, Mailgun, Postmark, SMTP) since attachment handling differs at the provider boundary.
Sequencing.
embed() usage and Markdown mail paths; disable where redundant.composer.json.Maintenance. Low day-to-day effort but non-zero stewardship: pin the version, watch upstream releases, and budget a review at every Laravel major upgrade. The single-maintainer profile argues for a documented fallback (native embed() calls or a two-line custom image-rewriting helper) that can be swapped in within an hour.
Support. Small support surface and easy to explain; most incidents will be "image missing" or "email too large," both diagnosable from raw MIME. Ensure at least two engineers can toggle it off without redeploying.
Scaling. Cost scales with email volume × payload size. Inlining is fine at low-to-moderate volume; at high volume, CID attachments inflate storage and egress at the provider and can hit message-size ceilings. For high-throughput senders, prefer absolute CDN-hosted image URLs and reserve inlining for critical images (logos, signatures).
Failure modes.
embed().Ramp-up. A Laravel developer is productive within a couple of hours; the real ramp is QA discipline (cross-client rendering, raw MIME inspection, size budgeting). Publish a short internal note covering config flags, kill switch, fallback approach, and test checklist before broad enablement.
How can I help you explore Laravel packages today?