Skip to content

Commit

Permalink
Send multipart email notification
Browse files Browse the repository at this point in the history
  • Loading branch information
tillkruss committed Aug 26, 2016
1 parent ae45047 commit bf4d338
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/Illuminate/Notifications/Messages/MailMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
19 changes: 19 additions & 0 deletions src/Illuminate/Notifications/resources/views/email-plain.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{ $level == 'error' ? 'Whoops!' : 'Hello!' }}

<?php
if (! empty($introLines)) {
echo implode("\r\n", $introLines), "\r\n\r\n";
}
if (isset($actionText)) {
echo "{$actionText}: {$actionUrl}\r\n\r\n";
}
if (! empty($outroLines)) {
echo implode("\r\n", $outroLines), "\r\n\r\n";
}
?>
Regards,
{{ config('app.name') }}
4 changes: 3 additions & 1 deletion tests/Notifications/NotificationMailChannelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit bf4d338

Please sign in to comment.