我正在try 自定义通过邮箱发送通知时使用的HTML邮箱布局.
I have published both the mail and notification views.
php artisan vendor:publish --tag=laravel-mail
个
php artisan vendor:publish --tag=laravel-notifications
If I modify the /resources/views/vendor/notifications/email.blade.php
file, I can only change the BODY content of the emails that get sent. I am looking to modify the footer, header, and every other part of the email layout as well.
我还try 在/resources/vendor/mail/html/
中修改视图,但每当发送通知时,它甚至不使用这些视图,而是使用默认的laravel框架视图.
我知道我可以设置通知类返回的MailMessage
的视图,但我想保留标准的line()
、greeting()
等函数.
Does anyone know how I can get my notifications to send email using the views in /resources/vendor/mail/html
?
The following is my /resources/views/vendor/notifications/email.blade.php
file, but it does not have anywhere to customize the header/footer/ overall layout.
@component('mail::message')
{{-- Greeting --}}
@if (! empty($greeting))
# {{ $greeting }}
@else
@if ($level == 'error')
# Whoops!
@else
# Hello!
@endif
@endif
{{-- Intro Lines --}}
@foreach ($introLines as $line)
{{ $line }}
@endforeach
{{-- Action Button --}}
@if (isset($actionText))
<?php
switch ($level) {
case 'success':
$color = 'green';
break;
case 'error':
$color = 'red';
break;
default:
$color = 'blue';
}
?>
@component('mail::button', ['url' => $actionUrl, 'color' => $color])
{{ $actionText }}
@endcomponent
@endif
{{-- Outro Lines --}}
@foreach ($outroLines as $line)
{{ $line }}
@endforeach
<!-- Salutation -->
@if (! empty($salutation))
{{ $salutation }}
@else
Regards,<br>{{ config('app.name') }}
@endif
<!-- Subcopy -->
@if (isset($actionText))
@component('mail::subcopy')
If you’re having trouble clicking the "{{ $actionText }}" button, copy and paste the URL below
into your web browser: [{{ $actionUrl }}]({{ $actionUrl }})
@endcomponent
@endif
@endcomponent