2017 © Pedro Peláez
 

library beautymail

Send beautiful html emails with Laravel

image

snowfire/beautymail

Send beautiful html emails with Laravel

  • Friday, December 1, 2017
  • by emilsundberg
  • Repository
  • 28 Watchers
  • 648 Stars
  • 102,425 Installations
  • CSS
  • 2 Dependents
  • 0 Suggesters
  • 101 Forks
  • 24 Open issues
  • 16 Versions
  • 12 % Grown

The README.md

Beautymail for Laravel

Beautymail makes it super easy to send beautiful responsive HTML emails. It's made for things like:, (*1)

  • Welcome emails
  • Password reminders
  • Invoices
  • Data exports

Index:

Templates

There are tons of great looking HTML email templates out there. Campaign Monitor and Mailchimp has released hundreds for free. It is pretty simple to adapt a template to Beautymail., (*2)

Widgets by Campaign Monitor:, (*3)

Widget Template, (*4)

Minty by Stamplia:, (*5)

Widget Template, (*6)

Sunny, (*7)

Widget Template, (*8)

Installation

Add the package to your composer.json by running:, (*9)

composer require snowfire/beautymail

Configure your settings such as logo url and social links in config/beautymail.php, (*10)

Send your first Beauty mail

Add this to your routes/web.php, (*11)

Route::get('/test', function()
{
    $beautymail = app()->make(Snowfire\Beautymail\Beautymail::class);
    $beautymail->send('emails.welcome', [], function($message)
    {
        $message
            ->from('bar@example.com')
            ->to('foo@example.com', 'John Smith')
            ->subject('Welcome!');
    });

});

Now create resources/views/emails/welcome.blade.php, (*12)

@extends('beautymail::templates.widgets')

@section('content')

    @include('beautymail::templates.widgets.articleStart')

        <h4 class="secondary"><strong>Hello World</strong></h4>
        <p>This is a test</p>

    @include('beautymail::templates.widgets.articleEnd')


    @include('beautymail::templates.widgets.newfeatureStart')

        <h4 class="secondary"><strong>Hello World again</strong></h4>
        <p>This is another test</p>

    @include('beautymail::templates.widgets.newfeatureEnd')

@stop

That's it!, (*13)

Options

Template: Widgets

To change colours for the different segments, pass a colour variable:, (*14)

@include('beautymail::templates.widgets.articleStart', ['color' => '#0000FF'])

Minty template example

@extends('beautymail::templates.minty')

@section('content')

    @include('beautymail::templates.minty.contentStart')
        <tr>
            <td class="title">
                Welcome Steve
            </td>
        </tr>
        <tr>
            <td width="100%" height="10"></td>
        </tr>
        <tr>
            <td class="paragraph">
                This is a paragraph text
            </td>
        </tr>
        <tr>
            <td width="100%" height="25"></td>
        </tr>
        <tr>
            <td class="title">
                This is a heading
            </td>
        </tr>
        <tr>
            <td width="100%" height="10"></td>
        </tr>
        <tr>
            <td class="paragraph">
                More paragraph text.
            </td>
        </tr>
        <tr>
            <td width="100%" height="25"></td>
        </tr>
        <tr>
            <td>
                @include('beautymail::templates.minty.button', ['text' => 'Sign in', 'link' => '#'])
            </td>
        </tr>
        <tr>
            <td width="100%" height="25"></td>
        </tr>
    @include('beautymail::templates.minty.contentEnd')

@stop

Ark template example

@extends('beautymail::templates.ark')

@section('content')

    @include('beautymail::templates.ark.heading', [
        'heading' => 'Hello World!',
        'level' => 'h1'
    ])

    @include('beautymail::templates.ark.contentStart')

        <h4 class="secondary"><strong>Hello World</strong></h4>
        <p>This is a test</p>

    @include('beautymail::templates.ark.contentEnd')

    @include('beautymail::templates.ark.heading', [
        'heading' => 'Another headline',
        'level' => 'h2'
    ])

    @include('beautymail::templates.ark.contentStart')

        <h4 class="secondary"><strong>Hello World again</strong></h4>
        <p>This is another test</p>

    @include('beautymail::templates.ark.contentEnd')

@stop

Sunny template example

@extends('beautymail::templates.sunny')

@section('content')

    @include ('beautymail::templates.sunny.heading' , [
        'heading' => 'Hello!',
        'level' => 'h1',
    ])

    @include('beautymail::templates.sunny.contentStart')

        <p>Today will be a great day!</p>

    @include('beautymail::templates.sunny.contentEnd')

    @include('beautymail::templates.sunny.button', [
            'title' => 'Click me',
            'link' => 'http://google.com'
    ])

@stop

Lumen support

In order to get this working on Lumen follow the installation instructions except for the artisan vendor:publish command, since Lumen does not provide this command. Instead you have to copy the assets folder from vendor/snowfire/beautymail/public/ to the public folder in your Lumen project manually., (*15)

Make sure to also put the beautymail.php config file in the config folder (default available in src/config/settings.php), (*16)

Enable mailing in Lumen

After this you will need to install and configure illuminate/mailer with:, (*17)

composer require illuminate/mail

and add this to your bootstrap/app.php:, (*18)

$app->withFacades();
$app->register(App\Providers\AppServiceProvider::class);

See this blog post for more details and how to use different mail libraries in lumen:, (*19)

Configure Beautymail classes and configuration parameters

In order to get Beautymail working on Lumen you need to add the following to your bootstrap/app.php in order to resolve missing config files, parameters and classes (before you register BeautymailServiceProvider):, (*20)

// Provide required path variables
$app->instance('path.config', env("STORAGE_DIR", app()->basePath()) . DIRECTORY_SEPARATOR . 'config');
$app->instance('path.public', env("STORAGE_DIR", app()->basePath()) . DIRECTORY_SEPARATOR . 'public');

// Enable config for beautymail
$app->configure('beautymail');

// Provide class alliases to resolve Request and Config
class_alias(\Illuminate\Support\Facades\Request::class, "\Request");
class_alias(\Illuminate\Support\Facades\Config::class, "\Config");

Start using Beautymail

Congratulations, you can know start using Beautymail in Lumen. See: Send your first Beauty mail on what to do next., (*21)

The Versions

01/12 2017

dev-master

9999999-dev

Send beautiful html emails with Laravel

  Sources   Download

MIT

The Requires

 

by Emil Sundberg

laravel email html

30/09 2017

dev-fix/version-constraint

dev-fix/version-constraint

Send beautiful html emails with Laravel

  Sources   Download

MIT

The Requires

 

by Emil Sundberg

laravel email html

22/09 2016

v1.0.12

1.0.12.0

Send beautiful html emails with Laravel

  Sources   Download

MIT

The Requires

 

by Emil Sundberg

laravel email html

23/05 2016

v1.0.11

1.0.11.0

Send beautiful html emails with Laravel

  Sources   Download

MIT

The Requires

 

by Emil Sundberg

laravel email html

19/04 2016

1.0.10

1.0.10.0

Send beautiful html emails with Laravel

  Sources   Download

MIT

The Requires

 

by Emil Sundberg

laravel email html

03/02 2016

v1.0.9

1.0.9.0

Send beautiful html emails with Laravel

  Sources   Download

MIT

The Requires

 

by Emil Sundberg

laravel email html

25/11 2015

v1.0.8

1.0.8.0

Send beautiful html emails with Laravel

  Sources   Download

MIT

The Requires

 

by Emil Sundberg

laravel email html

25/11 2015

v1.0.7

1.0.7.0

Send beautiful html emails with Laravel

  Sources   Download

MIT

The Requires

 

by Emil Sundberg

laravel email html

07/07 2015

1.x-dev

1.9999999.9999999.9999999-dev

Send beautiful html emails with Laravel

  Sources   Download

MIT

The Requires

 

by Emil Sundberg

laravel email html

09/02 2015

v1.0.6

1.0.6.0

Send beautiful html emails with Laravel

  Sources   Download

MIT

The Requires

 

by Emil Sundberg

laravel email html

10/09 2014

v1.0.5

1.0.5.0

Send beautiful html emails with Laravel

  Sources   Download

MIT

The Requires

 

by Emil Sundberg

laravel email html

13/08 2014

v1.0.4

1.0.4.0

Send beautiful html emails with Laravel

  Sources   Download

MIT

The Requires

 

by Emil Sundberg

laravel email html

27/07 2014

v1.0.3

1.0.3.0

Send beautiful html emails with Laravel

  Sources   Download

MIT

The Requires

 

by Emil Sundberg

laravel email html

27/07 2014

v1.0.2

1.0.2.0

  Sources   Download

The Requires

 

by Emil Sundberg

27/07 2014

v1.0.1

1.0.1.0

  Sources   Download

The Requires

 

by Emil Sundberg

27/07 2014

v1.0.0

1.0.0.0

  Sources   Download

The Requires

 

by Emil Sundberg