Download the PHP package niclas-van-eyk/laravel-mail-in-the-middle without Composer

On this page you can find all versions of the php package niclas-van-eyk/laravel-mail-in-the-middle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-mail-in-the-middle

✉️ Mail in the middle 📯

Preview the mails sent by your applications just like you would with services like Mailtrap. You can also view the template source and view data of your Mailables.

Build Status Total Downloads Latest Stable Version License

If you send a mail using Mail::send(new MyMailable()), the mail will be stored either in your database or on your filesystem. You can then visit localhost:8000/mails (or whatever your APP_URL is set to), to see the latest mails sent by your system. The UI shows metadata, like subject, sender, recipients, cc, bcc, as well as Laravel-specific information, like the source of your mail-template or the data provided to your template.

Setup

Installation

Require the library via composer:

Add the following entry to the mailers array in your config/mail.php:

If you are not seeing a 'mailers' section in your config/mail.php collapse this
This is probably either because you are using a Laravel version older than the *required* 7.2, or you started your project using the older configuration scheme and updated Laravel from there. For the latter case, just set your 'MAIL_DRIVER' environment variable to mail-in-the-middle and you are good to go.

Add / replace the following parts in your .env-file:

If you are sending your Mailables via the default Mailer (e.g Mail::to('[email protected]')->send(new MyMailable())) they will now show up in the UI. The UI is available, if APP_DEBUG is set to true. Otherwise it can be enabled/disabled by setting the MAIL_IN_THE_MIDDLE_ENABLED environment variable or by manually configuring the 'register_routes'-value of the config/mail-in-the-middle.php file.

WARNING: Any mails, that are sent using another mailer, e.g. if you explicitly define, that a Mailable should be sent through Mailgun using Mail::mailer('mailgun')->send(new MyMailable()) will be sent out to the recipient. The official documentation provides more information.

Configuration

For now, the package ships with two options to store your mails:

The filesystem driver was chosen to be the default storage option, as it just works out of the box. If no disk is set, a local folder under storage/app/mail-in-the-middle is created and used.

If a huge amount of mails are sent by your application, you should definitely consider using the database driver! You can configure the driver by setting the MAIL_IN_THE_MIDDLE_STORAGE_DRIVER environment variable to one of the options inside the config/mail-in-the-middle.php. If you are using the database driver, the necessary migrations should be loaded automatically, just make sure you call php artisan migrate before you send your first mail.

For all configuration options, like the path under which you can reach the ui, take a look at the mail-in-the-middle.php-config, which can be published and adjusted to your config/-directory.

Housekeeping

As it is more likely that you are more interested in the most recently sent mails, and for example the filesystem driver gets more slow the more mails are stored by your system, it is advised to delete old mails from time to time.

This can either be done through the UI using the red Delete-button, or by scheduling a command, that runs regularly and cleans up mails, that have passed a certain age. The latter can be done fairly easily if you have setup scheduling by adding the following to your App\Console\Kernel::schedule-method:

Alternatively you can run that command manually from time to time by executing php artisan mitm:clear-mails-older-than 'one week' in the shell of your choice.

More Screenshots

Source

In this tab you can see the contents of your .blade.php-view or markdown template. If you have a good idea on how to add syntax highlighting shoot me a dm, because I did not found one for higlightjs or prism (my last idea would be to try using the monaco editor and the blade-language-extension).

View Data

This tab shows the data that was used to render the html of the email as a var_dump. If the object is not a scalar value like an integer or a string, you can inspect the properties by collapsing / opening them using the black arrows next to them.

Scope, feature additions and contributing

The initial use case that sparked the creation of this package was to provide a project manager or tester with the abilityto easily inspect the mails sent by the application, without the risk of actually sending them out to potential users. Additionally, the mails never leave your system.

So if you import your users from a csv file and send them an initial password, you can safely run the importer on your dev or qa system, without accidentally sending out mails to real users.

As this use-case is satisfied, it is unlikely that more advanced features like advanced searching capabilities, multiple inboxes or other forms of access control will be added in the near future. This being said, if you want to contribute such features I am open to any PRs, but it is recommended to file an issue first with a description of your proposed feature addition to get some feedback.

Known issues

This package does not seem to function correctly if you set "minimum-stability" to "lowest" on windows. As I have currently no access to a windows machine I cannot reproduce this locally.


All versions of laravel-mail-in-the-middle with dependencies

PHP Build Version
Package Version
Requires php Version >= 7.2
ext-json Version *
laravel/framework Version ^7.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package niclas-van-eyk/laravel-mail-in-the-middle contains the following files

Loading the files please wait ....