0

I have a mail view named passwordReset.blade.php like this

<!DOCTYPE html>
<html>
<head>
    <title>Wachtwoord Reset</title>
    <style>
        body {
            font-family: "Calibri", sans-serif;
            color: #000000;
            font-size: 0.9167em;
        }
        .token {
            color: #00a9b5;
            font-weight: bold;
        }
    </style>
</head>
<body>
    <p>Beste gebruiker van de ,</p>
    <p>
        Er is een aanvraag gedaan voor het herstellen van je wachtwoord. Ben je dit niet geweest dan mag je deze e-mail negeren. Voor het opnieuw instellen van je wachtwoord voer je de onderstaande code in bij de app:
    </p>
    <p class="token">
        {{ $code }}
    </p>
    <p>
        Let op! Deze code is 30 minuten geldig.
    </p>

    <p>
        Hartelijke groet,
    </p>
</body>
</html>

But in the mail the code stays like this: {{ $code }}

This is my mailable class:

<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
use App\Models\User;

class PasswordResetNew extends Mailable
{
    use Queueable, SerializesModels;

    private User $user;
    /**
     * Create a new message instance.
     */
    public function __construct(User $user)
    {
        $this->user = $user;
    }

    /**
     * Get the message content definition.
     */
    public function content(): Content
    {
        return new Content(
            view: 'emails.passwordReset',
            with: [
                'code' => $this->user->USER_WACHTWOORD_RESETCODE,

            ],
        );
    }

    /**
     * Get the attachments for the message.
     *
     * @return array<int, \Illuminate\Mail\Mailables\Attachment>
     */
    public function attachments(): array
    {
        return [];
    }
}

And i have already debugged and the value is not empty before in the constructor and content functions.

And this mail gets called like this: Mail::to($user->USER_EMAIL) ->send(new PasswordResetNew($user));

Thanks

2
  • replace passwordReset.blade.php with password_reset.blade.php and double check the extension blade.php usually if you see not parsed {{ $variableName}} it is because your view is not recognized as blade template Commented Sep 15 at 10:21
  • Thanks for your comment. It appears that on ubuntu 24.04 when using php 8.3 this problem occurs but when downgrading to php 8.2 it fixes the problem without needing to change anything. Very weird but that has been my solution now Commented Sep 15 at 10:31

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.