Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Mail Auto Embed

Laravel Mail Auto Embed Laravel Package

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.

Deep Wiki
Context7

eduardokum/laravel-mail-auto-embed automatically turns <img> tags in your HTML emails into inline embedded images, so you never have to attach files manually or worry about broken images in mail clients. It wraps Laravel's mailer (Symfony Mailer/Swift Mailer) transparently, scanning each outgoing message and rewriting image sources as CID attachments—no changes to your Mailable code required.

  • Zero-config, global integration with Laravel's mail pipeline
  • Resolves local, public, and (optionally) remote image URLs
  • Configurable embed strategy, including CID or base64 data URIs
  • Per-Mailable opt-out and configurable exclusions
  • Compatible with modern Laravel releases and queued mail

Ideal for newsletters, receipts, and branded transactional email.

Frequently asked questions about Laravel Mail Auto Embed
How do I install laravel-mail-auto-embed in a Laravel app?
Install it with Composer using composer require eduardokum/laravel-mail-auto-embed. Laravel package auto-discovery registers the service provider, so the happy path requires no manual provider wiring. Publishing the config file is optional if you need to adjust behavior. You do not need to change Blade templates or Mailable sending code.
Which Laravel and PHP versions does laravel-mail-auto-embed support?
The package targets Laravel's mail rendering pipeline and modern Symfony Mailer-based Laravel releases. Because it depends on mail internals that change across major versions, verify the composer.json constraints and CI matrix for your exact Laravel and PHP versions before upgrading. Do not assume support for older SwiftMailer-based Laravel versions without checking.
Does it work with Laravel Markdown mailables?
Yes, it is designed to compose with Markdown mailables without template changes. The package rewrites image references during mail rendering, so Markdown mail paths can benefit from inline CID embedding like regular HTML mailables. Test one representative Markdown Mailable and inspect the raw MIME output to confirm behavior in your app.
Does laravel-mail-auto-embed fetch remote images, and is that an SSRF risk?
The package supports local and remote image sources, but remote fetching should be treated as an SSRF surface. Restrict resolution to trusted hosts or disable remote resolution where possible, and confine local path resolution to an allowed root. Prefer local assets or already-approved CDN URLs for production transactional email.
Will it double-embed images if my code already calls $message->embed()?
Automatic HTML rewriting can duplicate embedding when existing code already calls $message->embed() for the same image. Audit current embed usage first, then remove or disable redundant manual embedding for affected mailables. Send a test message and inspect the raw MIME structure to confirm each image appears only once.
How can I disable auto-embedding for a specific mailable?
Use the package config or an environment flag as a global kill switch for low-risk rollout and fast rollback. Confirm whether your installed version exposes per-mailable scoping before relying on it. If per-mailable control is not available, disable globally for streams that already embed images or gate the behavior through your own Mailable base class.
Does it work with queued Mailables and Laravel notifications?
It is intended to compose with Mailables, Notifications, and queued Mailables because it hooks into mail rendering rather than sending code. Queuing should not change the embedding behavior, but you should still test with your real queue worker and mail driver. Verify the rendered MIME after the job runs, especially if you use Markdown mail or custom Mailer decorators.
Does inline image embedding increase email size and affect deliverability?
Yes, converting images to inline CID attachments increases the size of each message and can push it toward provider size limits. Measure the payload delta for a typical transactional email with a logo and a few inline images. Keep images optimized, avoid unnecessary remote fetches, and confirm attachment handling with your actual provider such as SES, Mailgun, Postmark, or SMTP.
What are alternatives to laravel-mail-auto-embed?
Alternatives include manually calling $message->embed() in each Mailable, serving absolute CDN image URLs, or building a custom Mailer or Transport decorator. Manual embed calls give precise control but add template and sending-code changes across mailables. The package is most useful when you want inline images without editing every template, and least useful when email must stay tiny or a CDN already serves reliable absolute URLs.
Is laravel-mail-auto-embed production-ready and actively maintained?
It has a narrow architectural footprint and a recent release, but it has roughly 171 stars and effectively one maintainer, so bus-factor risk is real. Pin the version in composer.json, watch upstream releases, and budget a review at every Laravel major upgrade because mail internals can shift. Before production rollout, validate it behind a feature flag with one notification stream and confirm the CI and test posture for the exact version you adopt.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo
bernskioldmedia/laravel-harvest
bernskiold/laravel-data-scrubber
bernskiold/laravel-currency-converter
bernskiold/laravel-campaign-monitor
bernskioldmedia/laravel-autotranslate
siberfx/telegram-bot
roy-sandip/laravel-view-extended
gregsphotography/site-builder-core
roy-sandip/laravel-view
anodyne/blade-fluentui-icons
webx-ui/module-catalog-collections