我正在尝试用图像替换Laravel markdown电子邮件标题中的应用程序名称,但并没有成功。
message.blade.php
@component('mail::layout')
{{-- Header --}}
@slot('header')
@component('mail::header', ['url' => config('app.url')])
@if(config('app.site.logo'))
<img src="{{ url(config('app.site.logo')) }}" class="site-
logo" height="50" />
@else
{{ config('app.site.name', 'Campaign') }}
@endif
@endcomponent
@endslot
{{-- Body --}}
{{ $slot }}
{{-- Subcopy --}}
@isset($subcopy)
@slot('subcopy')
@component('mail::subcopy')
{{ $subcopy }}
@endcomponent
@endslot
@endisset
{{-- Footer --}}
@slot('footer')
@component('mail::footer')
© {{ date('Y') }} {{ config('app.site.name', 'Campaign') }}.
@lang('All rights reserved.')
@endcomponent
@endslot
@endcomponent
followup.blade.php <-电子邮件减价页面
@component('mail::message')
## Follow up reminder
Set for today {{ date('l \t\h\e jS \of F Y', strtotime($member->FollowUp)) }} with {{$member->LastName}} {{$member->FirstName}} / {{$member->Position}}
@component('mail::panel', ['url' => ''])
@if(count($member->notes))
*notes...*
@foreach($member->notes->sortByDesc("created_at") as $note)
**{!! nl2br(e($note->note)) !!}**
by *{{$note->user->name}}.*
@endforeach
@else
No notes added for member
@endif
@endcomponent
Probable Vote: {{$member->LikelyVote}}
@component('mail::button', ['url' => $the_url])
View Information
@endcomponent
Thank you,
{{ config('app.site.name', 'Campaign application A.I.') }}
@endcomponent
所有内容都可以在邮件陷阱上运行,并且显示标题图像。图片无法显示为gmail。
答案 0 :(得分:0)
在您的.env中设置
APP_NAME="YOUR APPLICATIONS NAME"
标头中的Laravel来自何处。
通过运行以下命令来发布markdown mailables的源代码,您可以进行更多控制:
php artisan vendor:publish --tag=laravel-mail
并在resources/views/vendor/mail
包括来自服务器的图像的方法是:
![Some option text][logo]
[logo]: {{asset('/img/official_logo.png')}} "Logo"
否则,您可以获取base64编码并将其拖放到img标签中,以真正嵌入图像(将其读入变量(图像)之后):
<img src="data:image/jpg;base64,{{ base64_encode($image) }}">