如何将图片放入我的电子邮件降价 header?
How can I put an image in my email markdown header?
我正在尝试用图片替换 Laravel 降价电子邮件 header 中的应用程序名称,但我没有取得很大成功。
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
mailtrap 一切正常,header 图像出现。该图片未显示在 gmail 中。
原始问题 - 如何去掉 header
中的“Laravel”
设置应用名称
在您的 .env 中设置
APP_NAME="YOUR APPLICATIONS NAME"
header 中的 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 标签中以真正嵌入图像(在将其读入变量 (image) 之后):
<img src="data:image/jpg;base64,{{ base64_encode($image) }}">
我正在尝试用图片替换 Laravel 降价电子邮件 header 中的应用程序名称,但我没有取得很大成功。
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
mailtrap 一切正常,header 图像出现。该图片未显示在 gmail 中。
原始问题 - 如何去掉 header
中的“Laravel”设置应用名称
在您的 .env 中设置
APP_NAME="YOUR APPLICATIONS NAME"
header 中的 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 标签中以真正嵌入图像(在将其读入变量 (image) 之后):
<img src="data:image/jpg;base64,{{ base64_encode($image) }}">