Download the PHP package rsvpify/laravel-mail-auto-embed without Composer
On this page you can find all versions of the php package rsvpify/laravel-mail-auto-embed. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rsvpify/laravel-mail-auto-embed
More information about rsvpify/laravel-mail-auto-embed
Files in rsvpify/laravel-mail-auto-embed
Package laravel-mail-auto-embed
Short Description Library for embed images in emails automatically
License MIT
Homepage https://github.com/rsvpify/laravel-mail-auto-embed
Informations about the package laravel-mail-auto-embed
Laravel Mail Auto Embed
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 also 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, example
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
.
You can then enable embedding for specific 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 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
illuminate/contracts Version >=5.3
illuminate/support Version >=5.3
illuminate/mail Version >=5.3