Download the PHP package eduardokum/laravel-mail-auto-embed without Composer
On this page you can find all versions of the php package eduardokum/laravel-mail-auto-embed. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download eduardokum/laravel-mail-auto-embed
More information about eduardokum/laravel-mail-auto-embed
Files in eduardokum/laravel-mail-auto-embed
Package laravel-mail-auto-embed
Short Description Library for embed images in emails automatically
License MIT
Homepage https://github.com/eduardokum/laravel-mail-auto-embed
Informations about the package 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 5.3+. Automatically tested for Laravel 5.4+ on PHP 7.0+.
Version Compatibility
Laravel | Package |
---|---|
\< 8.x | 1.x |
> 9.x | 2.x |
Install
You can install the package via composer:
This package uses Laravel 5.5 Package Auto-Discovery. For previous versions of Laravel, you need to add the following Service Provider:
Usage
Its use is very simple, you write your markdown normally:
When sending, it will replace the link that would normally be generated:
<img src="https://domain.com/products/product-1.png">
by an embedded inline attachment of the image:
<img src="cid:[email protected]">
.
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
For local resources that are not available publicly, use file://
urls:
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:
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.
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
.
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
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
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:
Then, you can use the embed:ClassName:id
syntax in your e-mail template:
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.
All versions of laravel-mail-auto-embed with dependencies
ext-dom Version *
illuminate/contracts Version ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
illuminate/support Version ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
illuminate/mail Version ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
masterminds/html5 Version ^2.7
ext-curl Version *
ext-fileinfo Version *