puz/mail_autoembed

Automatically embed all image sources in your emails
22 14
Install
composer require puz/mail_autoembed
Latest Version:0.1.0
License:MIT
Last Updated:Jul 17, 2016
Links: GitHub  ·  Packagist
Maintainer: Molteber

Puz - Auto embed for images Build Status

This package is mainly made for Laravel 5.2, but is fully useful for every application which uses Swift Mailer

To install: composer require puz/mail_autoembed

To use without laravel:

$mailer = new \Swift_Mailer;
$mailer->registerPlugin(new \Puz\Mail\AutoEmbed\ImagesToAttachments);

To use with laravel ^5.2:

// Add the service provider in the list of your service providers in app.php. It MUST be added after laravels mail service provider
$providers[
    ...
    \Puz\Mail\AutoEmbed\AutoEmbedServiceProvider::class,
    ...
 ];

This package will register two plugins to the mailer.

  • beforeSendPerformed
    • Right before the email is sent, it will scan the email for tags and it's src attribute. It will accept data:image, local image path and remote image
  • sendPerformed
    • Right after the mailer have sent the email away, it will go ahead and delete the temporary created images (for remote and data:image).

Contributions

Any suggestion or code improvement will be gladly accepted.

Future features

  • Save all the images which is attached. This can be useful in situations where the user send the email from a text editor and you need to display the email on your website as well. Good thing you saved the image right?!

Related Packages

larablocks/pigeon

A more flexible email message builder for Laravel 5 including chained methods, r...

3,706 14
sun/sunmailer

SunMailer helps you to send email easily.

453 3
coconutcraig/laravel-postmark

Laravel package for sending mail via the Postmark API

3,339,254 217
ritey/mailgun

A laravel 5 wrapper for sending mail via the Mailgun API in Laravel style

25 1
salopot/laravel-attach-image

Provides functionality for attach files to model and manipulate if file is image

48 0