Ad
How Can I Put An Image In My Email Markdown Header?
I am trying to replace the app name in a Laravel markdown email header with an image but I am not having a lot of success.
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 <-- email markdown page
@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
Everything works on mailtrap and the header image shows up. The image does not show up in gmail.
Ad
Answer
Original Question - How to get rid of "Laravel" in the header
Set the App Name
In your .env set the
APP_NAME="YOUR APPLICATIONS NAME"
Which is where the Laravel in the header is coming from.
Or Modify the Template
You can have more control by publishing the source for the markdown mailables by running:
php artisan vendor:publish --tag=laravel-mail
And editing them at resources/views/vendor/mail
Images
The way to include images from your server is:
![Some option text][logo]
[logo]: {{asset('/img/official_logo.png')}} "Logo"
Otherwise, you can get the base64 encoding and drop that into an img tag to truely embed the image (after reading it into a variable (image)):
<img src="data:image/jpg;base64,{{ base64_encode($image) }}">
Ad
source: stackoverflow.com
Related Questions
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS - Conditionally Load a Different Page
- → Make a Laravel collection into angular array (octobercms)
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?
- → Validating fileupload(image Dimensions) in Backend Octobercms
- → OctoberCMS Fileupload completely destroys my backend
- → How do I call the value from another backed page form and use it on a component in OctoberCms
Ad