PHPackages                             rsvpify/laravel-mail-auto-embed - 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. rsvpify/laravel-mail-auto-embed

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

rsvpify/laravel-mail-auto-embed
===============================

Library for embed images in emails automatically

1.0.8(6y ago)012.1k1[2 issues](https://github.com/rsvpify/laravel-mail-auto-embed/issues)[2 PRs](https://github.com/rsvpify/laravel-mail-auto-embed/pulls)MITPHPPHP &gt;=5.5.0

Since Mar 17Pushed 3y ago1 watchersCompare

[ Source](https://github.com/rsvpify/laravel-mail-auto-embed)[ Packagist](https://packagist.org/packages/rsvpify/laravel-mail-auto-embed)[ Docs](https://github.com/rsvpify/laravel-mail-auto-embed)[ RSS](/packages/rsvpify-laravel-mail-auto-embed/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (5)Versions (13)Used By (0)

[![Actions Status](https://github.com/rsvpify/laravel-mail-auto-embed/workflows/Testing%20Laravel%20Package/badge.svg)](https://github.com/rsvpify/laravel-mail-auto-embed/actions)

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

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

Install
-------

[](#install)

You can install the package via composer:

```
$ composer require rsvpify/laravel-mail-auto-embed
```

This package uses Laravel 5.5 Package Auto-Discovery.
For previous versions of Laravel, you need to add the following Service Provider:

```
$providers = [
    ...
    \Rsvpify\LaravelMailAutoEmbed\ServiceProvider::class,
    ...
 ];
```

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 also works for raw html too:

```
// eg: resources/vendor/mail/html/header.blade.php

```

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, example

```

```

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="Rsvpify\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`. You can then enable embedding for specific images with the `data-auto-embed` attribute.

```
# .env
MAIL_AUTO_EMBED=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 to `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 Rsvpify\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

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~125 days

Recently: every ~204 days

Total

9

Last Release

2339d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9c907c116225b0b9690d0b1bb70a9d1bb3bb1eac83712eb44c456df083e72aeb?d=identicon)[rsvpify](/maintainers/rsvpify)

---

Top Contributors

[![eduardokum](https://avatars.githubusercontent.com/u/2566340?v=4)](https://github.com/eduardokum "eduardokum (20 commits)")[![Djuuu](https://avatars.githubusercontent.com/u/2388233?v=4)](https://github.com/Djuuu "Djuuu (11 commits)")[![bryanjamesmiller](https://avatars.githubusercontent.com/u/8781182?v=4)](https://github.com/bryanjamesmiller "bryanjamesmiller (6 commits)")[![dvanscott](https://avatars.githubusercontent.com/u/38760117?v=4)](https://github.com/dvanscott "dvanscott (2 commits)")[![liliumdev](https://avatars.githubusercontent.com/u/8971846?v=4)](https://github.com/liliumdev "liliumdev (2 commits)")[![nmfzone](https://avatars.githubusercontent.com/u/10361906?v=4)](https://github.com/nmfzone "nmfzone (1 commits)")[![amenk](https://avatars.githubusercontent.com/u/1087128?v=4)](https://github.com/amenk "amenk (1 commits)")

---

Tags

laravel-mail-auto-embedrsvpify

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[laravel-notification-channels/telegram

Telegram Notifications Channel for Laravel

1.1k3.4M35](/packages/laravel-notification-channels-telegram)[mckenziearts/laravel-notify

Flexible flash notifications for Laravel

1.7k1.1M5](/packages/mckenziearts-laravel-notify)[fedeisas/laravel-mail-css-inliner

Inline the CSS of your HTML emails using Laravel

5974.6M3](/packages/fedeisas-laravel-mail-css-inliner)[s-ichikawa/laravel-sendgrid-driver

This library adds a 'sendgrid' mail driver to Laravel.

4139.3M1](/packages/s-ichikawa-laravel-sendgrid-driver)[propaganistas/laravel-disposable-email

Disposable email validator

5762.6M6](/packages/propaganistas-laravel-disposable-email)[eduardokum/laravel-mail-auto-embed

Library for embed images in emails automatically

1702.0M5](/packages/eduardokum-laravel-mail-auto-embed)

PHPackages © 2026

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