Skip to content

Commit

Permalink
update readme and change default preview path
Browse files Browse the repository at this point in the history
  • Loading branch information
themsaid committed Mar 13, 2016
1 parent e87ecb5 commit edba190
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 1 deletion.
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# The MIT License (MIT)

Copyright (c) 2015 Mohamed Said <[email protected]>

> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
58 changes: 58 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Laravel Mail Preview Driver

[![Latest Version on Packagist](https://img.shields.io/packagist/v/themsaid/laravel-mail-preview.svg?style=flat-square)](https://packagist.org/packages/themsaid/laravel-mail-preview)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)
[![Total Downloads](https://img.shields.io/packagist/dt/themsaid/laravel-mail-preview.svg?style=flat-square)](https://packagist.org/packages/themsaid/laravel-mail-preview)

This package introduces a new `preview` mail driver for laravel, when selected it will produce the output of the
sent emails and save it as HTML documents for you to check in a web browser.

## Installation

Begin by installing the package through Composer. Run the following command in your terminal:

```bash
composer require themsaid/laravel-mail-preview
```

Once composer is done, add the package service provider in the providers array in `config/app.php`:

```php
Themsaid\MailPreview\MailPreviewServiceProvider::class
```

Finally publish the config file:

```
php artisan vendor:publish
```

That's all, you only need to change the `MAIL_DRIVER` environment variable in the `.env` file to become `preview`.

## How it works

On every email sent a HTML document will be generated in `storage/email-previews` with a name that includes the first receiver and the subject:

```
1457904864_jack_at_gmail_com_invoice_000234.html
```

When opened in a web browser you'll be able to see how your email will look like, however there might be some differences that varies from
an email client to another.

At the beginning of the generated file you'll find a HTML comment with all the message info:

```html
<!--
From:{"[email protected]":"Acme HQ"},
to:{"[email protected]":"Jack Black"},
reply-to:"[email protected]",
cc:[{"[email protected]":"Acme Finance"}, {"[email protected]":"Acme Management"}],
bcc:null,
subject:Invoice #000234
-->
```

## Package Configurations
From the configuration file you'll be able to change the previews output location as well as the maximum life time for
keeping previews, after this time old previews will get removed.
2 changes: 1 addition & 1 deletion src/config/mailpreview.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*
*/

'path' => storage_path('framework/emails'),
'path' => storage_path('email-previews'),

/**
* --------------------------------------------------------------------------
Expand Down

0 comments on commit edba190

Please sign in to comment.