diff --git a/src/Illuminate/Notifications/Messages/MailMessage.php b/src/Illuminate/Notifications/Messages/MailMessage.php index ea4ae07cbbe4..cfbaee0fba7c 100644 --- a/src/Illuminate/Notifications/Messages/MailMessage.php +++ b/src/Illuminate/Notifications/Messages/MailMessage.php @@ -9,7 +9,10 @@ class MailMessage extends SimpleMessage * * @var string */ - public $view = 'notifications::email'; + public $view = [ + 'notifications::email.html', + 'notifications::email.text', + ]; /** * The view data for the message. diff --git a/src/Illuminate/Notifications/resources/views/email-plain.blade.php b/src/Illuminate/Notifications/resources/views/email-plain.blade.php new file mode 100644 index 000000000000..f5b35c0115bf --- /dev/null +++ b/src/Illuminate/Notifications/resources/views/email-plain.blade.php @@ -0,0 +1,19 @@ +{{ $level == 'error' ? 'Whoops!' : 'Hello!' }} + + +Regards, +{{ config('app.name') }} diff --git a/tests/Notifications/NotificationMailChannelTest.php b/tests/Notifications/NotificationMailChannelTest.php index 7e18db7c0ef0..4249dac6a675 100644 --- a/tests/Notifications/NotificationMailChannelTest.php +++ b/tests/Notifications/NotificationMailChannelTest.php @@ -22,7 +22,9 @@ public function testMailIsSentByChannel() $mailer = Mockery::mock(Illuminate\Contracts\Mail\Mailer::class) ); - $mailer->shouldReceive('send')->with('notifications::email', $data, Mockery::type('Closure')); + $view = ['notifications::email', 'notifications::email-plain']; + + $mailer->shouldReceive('send')->with($view, $data, Mockery::type('Closure')); $channel->send($notifiable, $notification); }