如何将图像放入我的电子邮件降价标题?

问题描述 投票:-1回答:1

我试图用图像替换Laravel降价电子邮件标题中的应用程序名称,但我没有取得很大成功。

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')
        &copy; {{ date('Y') }} {{ config('app.site.name', 'Campaign') }}. 
@lang('All rights reserved.')
    @endcomponent
@endslot
@endcomponent

关注up.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,标题图像显示出来。图像不会显示在Gmail中。

laravel laravel-5.8
1个回答
0
投票

原始问题 - 如何摆脱标题中的“Laravel”

Set the App Name

在你的.env中设置了

APP_NAME="YOUR APPLICATIONS NAME"

这是Laravel在标题中的来源。

Or Modify the Template

您可以通过运行以下命令来发布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) }}">
© www.soinside.com 2019 - 2024. All rights reserved.