I have a Laravel application and I want to send email. It works in my application and I can receive emails however the emails I receive look like this:
@component('mail::message') # Final step... Confirm your email address to complete your Twitter account {{ $user->username }}. It's easy — just click the button below. @component('mail::button', ['url' => $company->activation_code]) Confirm now @endcomponent Thanks, {{ config('app.name') }} @endcomponent
Somehow Laravel isnt even converting the components nor the variables. It is sending the view like a string.
The code to send an email is this:
Mail::to($company->email)->send(new CompanyActivation($company));
and the code in CompanyActivation is:
return $this->subject('Account activatie')->markdown('emails.companyactivation');
How can I tell Laravel to process the view and send it as html
CodePudding user response:
Make sure that all indents and spaces are correct.
When using markdown spaces or wrong indents will invoke a code block.
Try:
@component('mail::message')
# Final step...
Confirm your email address to complete your Twitter account {{ $user->username }}. It is easy — just click the button below.
@component('mail::button', ['url' => $company->activation_code])
Confirm now
@endcomponent
Thanks, {{ config('app.name') }}
@endcomponent
Instead of:
@component('mail::message') # Final step... Confirm your email address to complete your Twitter account {{ $user->username }}. It's easy — just click the button below. @component('mail::button', ['url' => $company->activation_code]) Confirm now @endcomponent Thanks, {{ config('app.name') }} @endcomponent
CodePudding user response:
I found the solution. There seams to be something very wierd with Laravel 8 with mails. I replaced the entire mail content with a pure html5 file and now the email is received as html. So it seams that Laravel has a issue in the mailing module once you use component.