PHPackages                             gabrielrbarbosa/laravel-mail-auto-embed-13 - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. gabrielrbarbosa/laravel-mail-auto-embed-13

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

gabrielrbarbosa/laravel-mail-auto-embed-13
==========================================

Library for embed images in emails automatically

13.0.0(3w ago)0969—2.3%1MITPHPPHP ^7.2|^8.0|^8.1|^8.2

Since Mar 17Pushed 1mo agoCompare

[ Source](https://github.com/gabrielrbarbosa/laravel-mail-auto-embed-13)[ Packagist](https://packagist.org/packages/gabrielrbarbosa/laravel-mail-auto-embed-13)[ Docs](https://github.com/eduardokum/laravel-mail-auto-embed)[ GitHub Sponsors](https://github.com/eduardokum)[ RSS](/packages/gabrielrbarbosa-laravel-mail-auto-embed-13/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)Dependencies (14)Versions (18)Used By (1)

[![Packagist](https://camo.githubusercontent.com/90abb2b3f1c0bff3ab51bf1b930d654965e313926bc319fba46b1a784f639b5e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6761627269656c72626172626f73612f6c61726176656c2d6d61696c2d6175746f2d656d6265642d31332e7376673f7374796c653d666c61742d737175617265)](https://github.com/gabrielrbarbosa/laravel-mail-auto-embed-13)[![Packagist](https://camo.githubusercontent.com/8ed65001aed81f2cffd6cf8bb63b2c219605bf8a69f26c58dc01cc0a0fd7a560/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6761627269656c72626172626f73612f6c61726176656c2d6d61696c2d6175746f2d656d6265642d31332e7376673f7374796c653d666c61742d737175617265)](https://github.com/gabrielrbarbosa/laravel-mail-auto-embed-13)[![Packagist](https://camo.githubusercontent.com/3a1e663653aa1ea14bd48c5336a0a53b84d0d4ab3381bb67994040ac1ad6a4d3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6761627269656c72626172626f73612f6c61726176656c2d6d61696c2d6175746f2d656d6265642d31332e7376673f7374796c653d666c61742d737175617265)](https://github.com/gabrielrbarbosa/laravel-mail-auto-embed-13)[![Laravel Compatibility](https://camo.githubusercontent.com/c8495a36ccf4954f6bdd300f2bdb43460dbe39a13de2f7011f6b6775844c89d3/68747470733a2f2f62616467652e6c61726176656c2e636c6f75642f62616467652f6761627269656c72626172626f73612f6c61726176656c2d6d61696c2d6175746f2d656d6265642d3133)](https://packagist.org/packages/gabrielrbarbosa/laravel-mail-auto-embed-13)

Laravel Mail Auto Embed
=======================

[](#laravel-mail-auto-embed)

Automatically parses your messages and embeds the images found into your mail, replacing the original online-version of the image.

Should work on Laravel 13.x.

Usage
-----

[](#usage)

Its use is very simple, you write your markdown normally:

```

@component('mail::message')
# Order Shipped

Your order has been shipped!

@component('mail::button', ['url' => $url])
View Order
@endcomponent

Purchased product:

![product](https://domain.com/products/product-1.png)

Thanks,
{{ config('app.name') }}
@endcomponent
```

When sending, it will replace the link that would normally be generated:

> ``

by an embedded inline attachment of the image:

> ``.

It works for raw html too:

```

```

If you do not want to use automatic embedding for specific images (because they are hosted elsewhere, if you want to use some kind of image tracker, etc.), simply add the attribute `data-skip-embed` in the image tag:

```

```

### Local resources

[](#local-resources)

For local resources that are not available publicly, use `file://` urls:

```

```

Configuration
-------------

[](#configuration)

The defaults are set in `config/mail-auto-embed.php`. You can copy this file to your own config directory to modify the values using this command:

```
php artisan vendor:publish --provider="Eduardokum\LaravelMailAutoEmbed\ServiceProvider"
```

### Explicit embedding configuration

[](#explicit-embedding-configuration)

By default, images are embedded automatically, unless you add the `data-skip-embed` attribute.

You can also disable auto-embedding globally by setting the `MAIL_AUTO_EMBED`environment variable to `false`, or by modifying the `enabled` property in the published config. You can then enable embedding for individual images with the `data-auto-embed` attribute.

```
# .env
MAIL_AUTO_EMBED=false
```

```
return [
    /*
    |--------------------------------------------------------------------------
    | Mail auto embed
    |--------------------------------------------------------------------------
    |
    | If true, images will be automatically embedded.
    | If false, only images with the 'data-auto-embed' attribute will be embedded
    |
    */
    'enabled' => false,

    // …
];
```

```

```

### Base64 embedding

[](#base64-embedding)

If you prefer to use Base64 instead of inline attachments, you can do so by setting the `MAIL_AUTO_EMBED_METHOD` environment variable or the `method`config property to `base64`.

```
return [
    // …

    /*
    |--------------------------------------------------------------------------
    | Mail embed method
    |--------------------------------------------------------------------------
    |
    | Supported: "attachment", "base64"
    |
    */
    'method' => 'base64',
];
```

Note that it will increase the e-mail size, and that it won't be decoded by some e-mail clients such as Gmail.

Mixed embedding methods
-----------------------

[](#mixed-embedding-methods)

If you want to use both inline attachment and Base64 depending on the image, you can specify the embedding method as the `data-auto-embed` attribute value:

```

```

Embedding entities
------------------

[](#embedding-entities)

You might want to embed images that don't actually exist in your filesystem (stored in the database).

In that case, make the entities you want to embed implement the `EmbeddableEntity` interface:

```
namespace App\Models;

use Eduardokum\LaravelMailAutoEmbed\Models\EmbeddableEntity;
use Illuminate\Database\Eloquent\Model;

class Picture extends Model implements EmbeddableEntity
{
    /**
     * @param  mixed  $id
     * @return Picture
     */
    public static function findEmbeddable($id)
    {
        return static::find($id);
    }

    /**
     * @return mixed
     */
    public function getRawContent()
    {
        return $this->data;
    }

    /**
     * @return string
     */
    public function getFileName()
    {
        return 'profile_'.$this->id.'.png';
    }

    /**
     * @return string
     */
    public function getMimeType()
    {
        return 'image/png';
    }
}
```

Then, you can use the `embed:ClassName:id` syntax in your e-mail template:

```

```

Contributing
------------

[](#contributing)

Please feel free to submit pull requests if you can improve or add any features.

We are currently using PSR-2. This is easy to implement and check with the PHP Coding Standards Fixer.

[ ![Donate with Paypal](https://camo.githubusercontent.com/0293c3ea1e6dbe13508306375f69c8d21d79fce0478eb6f60e84c512d7e5192c/68747470733a2f2f7777772e70617970616c6f626a656374732e636f6d2f656e5f55532f47422f692f62746e2f62746e5f646f6e61746543435f4c472e676966)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=QPDFT3UXS6PTL&lc=GB&item_name=laravel%2dmail%2dauto%2dembed&item_number=laravel%2dmail%2dauto%2dembed&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted)

###  Health Score

56

—

FairBetter than 97% of packages

Maintenance91

Actively maintained with recent releases

Popularity19

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity84

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 69.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~240 days

Recently: every ~298 days

Total

15

Last Release

25d ago

Major Versions

1.0.7 → 2.0.02022-03-09

0.13 → 13.0.02026-06-02

PHP version history (4 changes)1.0.0PHP &gt;=5.5.0

1.0.5PHP &gt;=5.6

1.0.6PHP ^7.2|^8.0

2.12PHP ^7.2|^8.0|^8.1|^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/7ecbe12c1187c3d82c6a112fbe0b883fd47212f5112a504903b010cf9ef38425?d=identicon)[gabrielrbarbosa](/maintainers/gabrielrbarbosa)

---

Top Contributors

[![eduardokum](https://avatars.githubusercontent.com/u/2566340?v=4)](https://github.com/eduardokum "eduardokum (86 commits)")[![Djuuu](https://avatars.githubusercontent.com/u/2388233?v=4)](https://github.com/Djuuu "Djuuu (11 commits)")[![okaufmann](https://avatars.githubusercontent.com/u/4414498?v=4)](https://github.com/okaufmann "okaufmann (10 commits)")[![Nielsvanpach](https://avatars.githubusercontent.com/u/10651054?v=4)](https://github.com/Nielsvanpach "Nielsvanpach (4 commits)")[![shaffe-fr](https://avatars.githubusercontent.com/u/3834222?v=4)](https://github.com/shaffe-fr "shaffe-fr (2 commits)")[![riasvdv](https://avatars.githubusercontent.com/u/3626559?v=4)](https://github.com/riasvdv "riasvdv (2 commits)")[![sdapkus](https://avatars.githubusercontent.com/u/58326108?v=4)](https://github.com/sdapkus "sdapkus (2 commits)")[![gabrielrbarbosa](https://avatars.githubusercontent.com/u/12158575?v=4)](https://github.com/gabrielrbarbosa "gabrielrbarbosa (2 commits)")[![nmfzone](https://avatars.githubusercontent.com/u/10361906?v=4)](https://github.com/nmfzone "nmfzone (1 commits)")[![ilvalerione](https://avatars.githubusercontent.com/u/13559278?v=4)](https://github.com/ilvalerione "ilvalerione (1 commits)")[![amenk](https://avatars.githubusercontent.com/u/1087128?v=4)](https://github.com/amenk "amenk (1 commits)")[![qlic-koen](https://avatars.githubusercontent.com/u/78430280?v=4)](https://github.com/qlic-koen "qlic-koen (1 commits)")[![rubenvanassche](https://avatars.githubusercontent.com/u/619804?v=4)](https://github.com/rubenvanassche "rubenvanassche (1 commits)")

---

Tags

eduardokumlaravel-mail-auto-embed

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/gabrielrbarbosa-laravel-mail-auto-embed-13/health.svg)

```
[![Health](https://phpackages.com/badges/gabrielrbarbosa-laravel-mail-auto-embed-13/health.svg)](https://phpackages.com/packages/gabrielrbarbosa-laravel-mail-auto-embed-13)
```

###  Alternatives

[eduardokum/laravel-mail-auto-embed

Library for embed images in emails automatically

1702.1M9](/packages/eduardokum-laravel-mail-auto-embed)[illuminate/notifications

The Illuminate Notifications package.

483.0M1.1k](/packages/illuminate-notifications)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[propaganistas/laravel-disposable-email

Disposable email validator

6012.9M7](/packages/propaganistas-laravel-disposable-email)[laravel/ai

The official AI SDK for Laravel.

9782.1M162](/packages/laravel-ai)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45344.0k1](/packages/pressbooks-pressbooks)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
