Martijn Hiemstra
Martijn Hiemstra

Reputation: 1170

Laravel not processing view as html

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

Upvotes: 0

Views: 62

Answers (2)

Martijn Hiemstra
Martijn Hiemstra

Reputation: 1170

I found the solution. I started the file by manually creating the email blade file. I then started a new email template using the php artisan command. I pasted the content in the newly created file and everything works now.

Upvotes: 1

Stijn Bakker
Stijn Bakker

Reputation: 36

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

Upvotes: 0

Related Questions