diff --git a/app/Bus/Handlers/Events/Component/SendComponentUpdateEmailNotificationHandler.php b/app/Bus/Handlers/Events/Component/SendComponentUpdateEmailNotificationHandler.php index 264d2bf5..38dd9689 100644 --- a/app/Bus/Handlers/Events/Component/SendComponentUpdateEmailNotificationHandler.php +++ b/app/Bus/Handlers/Events/Component/SendComponentUpdateEmailNotificationHandler.php @@ -57,7 +57,7 @@ class SendComponentUpdateEmailNotificationHandler */ public function handle(ComponentWasUpdatedEvent $event) { - $component = AutoPresenter::decorate($event->component); + $component = $event->component; // First notify all global subscribers. $globalSubscribers = $this->subscriber->isVerified()->isGlobal()->get(); @@ -92,6 +92,8 @@ class SendComponentUpdateEmailNotificationHandler */ public function notify(Component $component, Subscriber $subscriber) { + $component = AutoPresenter::decorate($component); + $mail = [ 'subject' => trans('cachet.subscriber.email.component.subject'), 'component_name' => $component->name, diff --git a/app/Bus/Handlers/Events/Incident/SendIncidentEmailNotificationHandler.php b/app/Bus/Handlers/Events/Incident/SendIncidentEmailNotificationHandler.php index f55c263d..f92e49c0 100644 --- a/app/Bus/Handlers/Events/Incident/SendIncidentEmailNotificationHandler.php +++ b/app/Bus/Handlers/Events/Incident/SendIncidentEmailNotificationHandler.php @@ -107,9 +107,14 @@ class SendIncidentEmailNotificationHandler $mail = [ 'email' => $subscriber->email, - 'subject' => 'New incident reported.', + 'subject' => trans('cachet.subscriber.email.incident.subject', [ + 'status' => $incident->human_status, + 'name' => $incident->name, + ]), 'has_component' => ($event->incident->component) ? true : false, 'component_name' => $component ? $component->name : null, + 'name' => $incident->name, + 'timestamp' => $incident->created_at_formatted, 'status' => $incident->human_status, 'html_content' => $incident->formattedMessage, 'text_content' => $incident->message, diff --git a/app/Bus/Handlers/Events/Incident/SendMaintenanceEmailNotificationHandler.php b/app/Bus/Handlers/Events/Incident/SendMaintenanceEmailNotificationHandler.php index 7d9d9708..faa4fd38 100644 --- a/app/Bus/Handlers/Events/Incident/SendMaintenanceEmailNotificationHandler.php +++ b/app/Bus/Handlers/Events/Incident/SendMaintenanceEmailNotificationHandler.php @@ -107,9 +107,13 @@ class SendMaintenanceEmailNotificationHandler $mail = [ 'email' => $subscriber->email, - 'subject' => 'Scheduled maintenance.', + 'subject' => trans('cachet.subscriber.email.maintenance.subject', [ + 'name' => $incident->name, + ]), 'has_component' => ($event->incident->component) ? true : false, 'component_name' => $component ? $component->name : null, + 'name' => $incident->name, + 'timestamp' => $incident->scheduled_at_formatted, 'status' => $incident->human_status, 'html_content' => $incident->formattedMessage, 'text_content' => $incident->message, diff --git a/app/Foundation/Providers/ComposerServiceProvider.php b/app/Foundation/Providers/ComposerServiceProvider.php index 3f42bab6..7831d008 100644 --- a/app/Foundation/Providers/ComposerServiceProvider.php +++ b/app/Foundation/Providers/ComposerServiceProvider.php @@ -34,7 +34,7 @@ class ComposerServiceProvider extends ServiceProvider $factory->composer('*', CurrentUserComposer::class); $factory->composer(['index'], MetricsComposer::class); $factory->composer(['index', 'single-incident', 'subscribe', 'signup'], StatusPageComposer::class); - $factory->composer(['index', 'single-incident', 'subscribe.*', 'signup', 'dashboard.settings.theme'], ThemeComposer::class); + $factory->composer(['index', 'single-incident', 'subscribe.*', 'signup', 'dashboard.settings.theme', 'emails.*'], ThemeComposer::class); $factory->composer('dashboard.*', DashboardComposer::class); $factory->composer(['setup', 'dashboard.settings.localization'], TimezoneLocaleComposer::class); } diff --git a/composer.json b/composer.json index 367b312a..5eefbffc 100644 --- a/composer.json +++ b/composer.json @@ -29,6 +29,7 @@ "backup-manager/laravel": "^1.1", "barryvdh/laravel-cors": "^0.8", "doctrine/dbal": "^2.5", + "fedeisas/laravel-mail-css-inliner": "^1.5", "fideloper/proxy": "^3.1", "graham-campbell/binput": "^3.4", "graham-campbell/core": "^5.1", diff --git a/composer.lock b/composer.lock index cbb76683..0e9d08e1 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "d58416fb0d16c8b7fc9b936b6f642c39", - "content-hash": "226b91629f9aa94bb32446a4e963600c", + "hash": "9d38d3ba627f866fa276370913d9bf70", + "content-hash": "b75a2ca8a01159ff0a136823a7f26e88", "packages": [ { "name": "alt-three/badger", @@ -1150,6 +1150,58 @@ ], "time": "2014-09-09 13:34:57" }, + { + "name": "fedeisas/laravel-mail-css-inliner", + "version": "1.5", + "source": { + "type": "git", + "url": "https://github.com/fedeisas/laravel-mail-css-inliner.git", + "reference": "8c3cd958634e865a90fc398900ea59c427dd35cc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/fedeisas/laravel-mail-css-inliner/zipball/8c3cd958634e865a90fc398900ea59c427dd35cc", + "reference": "8c3cd958634e865a90fc398900ea59c427dd35cc", + "shasum": "" + }, + "require": { + "illuminate/support": "~5.0", + "php": ">=5.4.0", + "tijsverkoyen/css-to-inline-styles": "~1.2" + }, + "require-dev": { + "jakub-onderka/php-console-highlighter": "0.3.*", + "jakub-onderka/php-parallel-lint": "0.8.*", + "phpmd/phpmd": "~1.5", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "~0.7@dev", + "squizlabs/php_codesniffer": "~1.5", + "swiftmailer/swiftmailer": "~5.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Fedeisas\\LaravelMailCssInliner\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fede Isas", + "email": "fedeisas@hotmail.com" + } + ], + "description": "Inline the CSS of your HTML emails using Laravel", + "keywords": [ + "css", + "laravel", + "mailer" + ], + "time": "2016-04-19 07:02:48" + }, { "name": "fideloper/proxy", "version": "3.1.0", @@ -2988,6 +3040,59 @@ "homepage": "https://symfony.com", "time": "2016-04-28 09:48:42" }, + { + "name": "symfony/css-selector", + "version": "v3.0.6", + "source": { + "type": "git", + "url": "https://github.com/symfony/css-selector.git", + "reference": "65e764f404685f2dc20c057e889b3ad04b2e2db0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/65e764f404685f2dc20c057e889b3ad04b2e2db0", + "reference": "65e764f404685f2dc20c057e889b3ad04b2e2db0", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\CssSelector\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jean-François Simon", + "email": "jeanfrancois.simon@sensiolabs.com" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony CssSelector Component", + "homepage": "https://symfony.com", + "time": "2016-03-04 07:55:57" + }, { "name": "symfony/debug", "version": "v3.0.6", @@ -3707,6 +3812,53 @@ ], "time": "2016-04-25 11:17:47" }, + { + "name": "tijsverkoyen/css-to-inline-styles", + "version": "1.5.5", + "source": { + "type": "git", + "url": "https://github.com/tijsverkoyen/CssToInlineStyles.git", + "reference": "9753fc340726e327e4d48b7c0604f85475ae0bc3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/9753fc340726e327e4d48b7c0604f85475ae0bc3", + "reference": "9753fc340726e327e4d48b7c0604f85475ae0bc3", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "symfony/css-selector": "~2.1|~3.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.5.x-dev" + } + }, + "autoload": { + "psr-4": { + "TijsVerkoyen\\CssToInlineStyles\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD" + ], + "authors": [ + { + "name": "Tijs Verkoyen", + "email": "css_to_inline_styles@verkoyen.eu", + "role": "Developer" + } + ], + "description": "CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.", + "homepage": "https://github.com/tijsverkoyen/CssToInlineStyles", + "time": "2015-12-08 16:14:14" + }, { "name": "twig/twig", "version": "v1.24.0", @@ -5066,59 +5218,6 @@ "homepage": "https://github.com/sebastianbergmann/version", "time": "2015-06-21 13:59:46" }, - { - "name": "symfony/css-selector", - "version": "v3.0.6", - "source": { - "type": "git", - "url": "https://github.com/symfony/css-selector.git", - "reference": "65e764f404685f2dc20c057e889b3ad04b2e2db0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/65e764f404685f2dc20c057e889b3ad04b2e2db0", - "reference": "65e764f404685f2dc20c057e889b3ad04b2e2db0", - "shasum": "" - }, - "require": { - "php": ">=5.5.9" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\CssSelector\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jean-François Simon", - "email": "jeanfrancois.simon@sensiolabs.com" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony CssSelector Component", - "homepage": "https://symfony.com", - "time": "2016-03-04 07:55:57" - }, { "name": "symfony/dom-crawler", "version": "v3.0.6", diff --git a/config/app.php b/config/app.php index 8d00d1e2..3a5d4fd9 100644 --- a/config/app.php +++ b/config/app.php @@ -164,6 +164,7 @@ return [ 'AltThree\Emoji\EmojiServiceProvider', 'BackupManager\Laravel\Laravel5ServiceProvider', 'Barryvdh\Cors\ServiceProvider', + 'Fedeisas\LaravelMailCssInliner\LaravelMailCssInlinerServiceProvider', 'Fideloper\Proxy\TrustedProxyServiceProvider', 'GrahamCampbell\Binput\BinputServiceProvider', 'GrahamCampbell\Exceptions\ExceptionsServiceProvider', diff --git a/public/img/button-email--dark-grey.png b/public/img/button-email--dark-grey.png new file mode 100644 index 00000000..606ed16e Binary files /dev/null and b/public/img/button-email--dark-grey.png differ diff --git a/resources/lang/en/cachet.php b/resources/lang/en/cachet.php index 445c361a..f8a1cd83 100755 --- a/resources/lang/en/cachet.php +++ b/resources/lang/en/cachet.php @@ -75,32 +75,27 @@ return [ 'subscribe' => 'Subscribe to email updates.', 'subscribed' => 'You\'ve been subscribed to email notifications, please check your email to confirm your subscription.', 'verified' => 'Your email subscription has been confirmed. Thank you!', - 'manage' => 'Manage your subscription.', + 'manage' => 'Manage your subscription', 'unsubscribe' => 'Unsubscribe from email updates.', 'unsubscribed' => 'Your email subscription has been cancelled.', 'failure' => 'Something went wrong with the subscription.', 'already-subscribed' => 'Cannot subscribe :email because they\'re already subscribed.', 'verify' => [ - 'text' => "Please confirm your email subscription to :app_name status updates.\n:link\nThank you, :app_name", - 'html-preheader' => 'Please confirm your email subscription to :app_name status updates.', - 'html' => '
Please confirm your email subscription to :app_name status updates.
Thank you, :app_name
', + 'text' => "Please confirm your email subscription to :app_name status updates.\n:link", + 'html' => 'Please confirm your email subscription to :app_name status updates.
', + 'button' => 'Confirm Subscription', ], 'maintenance' => [ - 'text' => "New maintenance has been scheduled on :app_name.\nThank you, :app_name", - 'html-preheader' => 'New maintenance has been scheduled on :app_name.', - 'html' => 'New maintenance has been scheduled on :app_name.
', + 'subject' => '[Maintenance Scheduled] :name', ], 'incident' => [ - 'text' => "New incident has been reported on :app_name.\nThank you, :app_name", - 'html-preheader' => 'New incident has been reported on :app_name.', - 'html' => 'New incident has been reported on :app_name.
Thank you, :app_name
', + 'subject' => '[New Incident] :status: :name', ], 'component' => [ - 'subject' => 'Component Status Update', - 'text' => 'The component :component_name has seen a status change. The component is now at :component_human_status.\nThank you, :app_name', - 'html-preheader' => 'Component Update from :app_name', - 'html' => 'The component :component_name has seen a status change. The component is now at :component_human_status.
Thank you, :app_name
', - 'tooltip-title' => 'Subscribe to notifications for :component_name.', + 'subject' => 'Component Status Update', + 'text' => 'The component :component_name has seen a status change. The component is now at :component_human_status.\nThank you, :app_name', + 'html' => 'The component :component_name has seen a status change. The component is now at :component_human_status.
Thank you, :app_name
', + 'tooltip-title' => 'Subscribe to notifications for :component_name.', ], ], ], @@ -109,7 +104,6 @@ return [ 'email' => [ 'invite' => [ 'text' => "You have been invited to the team :app_name status page, to sign up follow the next link.\n:link\nThank you, :app_name", - 'html-preheader' => 'You have been invited to the team :app_name.', 'html' => 'You have been invited to the team :app_name status page, to sign up follow the next link.
Thank you, :app_name
', ], ], diff --git a/resources/views/emails/components/update-html.blade.php b/resources/views/emails/components/update-html.blade.php index abe4bdc0..d99acb78 100644 --- a/resources/views/emails/components/update-html.blade.php +++ b/resources/views/emails/components/update-html.blade.php @@ -1,16 +1,20 @@ @extends('layout.emails') -@section('preheader') -{!! trans('cachet.subscriber.email.component.html-preheader', ['app_name' => $app_name]) !!} -@stop - @section('content') {!! trans('cachet.subscriber.email.component.html', ['component_name' => $component_name, 'component_human_status' => $component_human_status, 'app_name' => $app_name]) !!} -@if($show_support) -{!! trans('cachet.powered_by', ['app' => $app_name]) !!}
-@endif -- {!! trans('cachet.subscriber.email.manage') !!} -
+| + + | +
{{ $scheduled_at }}
+|
+ + {!! $status !!} @if($has_component) ({{ $component_name }}) @endif + {!! $html_content !!} + {!! $timestamp !!} + + |
+
- {!! $status !!} -
+| + + | +
- {!! $html_content !!} -
- -@if($show_support) -{!! trans('cachet.powered_by', ['app' => $app_name]) !!}
-@endif -- {!! trans('cachet.subscriber.email.manage') !!} -
-- {!! trans('cachet.subscriber.email.unsubscribe') !!} -
+| + + | +
- {!! $status !!} - @if($has_component) - ({{ $component_name }}) - @endif -
+|
+ + {!! $status !!} @if($has_component) ({{ $component_name }}) @endif + {!! $html_content !!} + {!! $timestamp !!} + + |
+
- {!! $html_content !!} -
+| + + | +
{!! trans('cachet.powered_by', ['app' => $app_name]) !!}
-@endif -- {!! trans('cachet.subscriber.email.manage') !!} -
-- {!! trans('cachet.subscriber.email.unsubscribe') !!} -
+| + + | +
{!! trans('cachet.powered_by', ['app' => $app_name]) !!}
-@endif +| + + | +
{!! trans('cachet.powered_by', ['app' => $app_name]) !!}
- @endif +{!! trans('cachet.users.email.invite.html', ['app_name' => $app_name, 'link' => $link]) !!} @stop diff --git a/resources/views/layout/emails.blade.php b/resources/views/layout/emails.blade.php index 152cb847..bc136388 100644 --- a/resources/views/layout/emails.blade.php +++ b/resources/views/layout/emails.blade.php @@ -1,38 +1,234 @@ - - + + - - - - -
-
|