Package Data | |
---|---|
Maintainer Username: | emilsundberg |
Maintainer Contact: | emil@snowfire.net (Emil Sundberg) |
Package Create Date: | 2014-07-27 |
Package Last Update: | 2024-10-20 |
Language: | Blade |
License: | MIT |
Last Refreshed: | 2024-11-22 15:04:36 |
Package Statistics | |
---|---|
Total Downloads: | 660,054 |
Monthly Downloads: | 3,714 |
Daily Downloads: | 138 |
Total Stars: | 1,255 |
Total Watchers: | 32 |
Total Forks: | 209 |
Total Open Issues: | 0 |
Beautymail makes it super easy to send beautiful responsive HTML emails. It's made for things like:
If you're on Laravel 4, use the 1.x
branch.
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. If you do, please send a PR.
Widgets by Campaign Monitor:
Minty by Stamplia:
Sunny
Add the package to your composer.json
by running:
composer require snowfire/beautymail dev-master
When it's installed, add it to the providers list in config/app.php
Snowfire\Beautymail\BeautymailServiceProvider::class,
Publish assets to your public folder
php artisan vendor:publish --provider="Snowfire\Beautymail\BeautymailServiceProvider"
Configure your settings such as logo url and social links in config/beautymail.php
Add this to your routes.php
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
@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!
To change colours for the different segments, pass a colour variable:
@include('beautymail::templates.widgets.articleStart', ['color' => '#0000FF'])
@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
@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
@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