Forum

Data not parsing in my email template

I have a registration email that is sent out with an activation link which is generated at the time of user creation. I am sending an email after the user is created, along with the activation link and a few other placeholder values.

In my RegistrationController is my mail to method:

\Mail::to($data['email'])
          ->send(new Activation($activation->toString(), $data['username']));

The in my Activation Mailer class:

public function __construct($activation, $username)
{
    //
    $this->activation = $activation;
    $this->site = config('app.name');
    $this->username = $username;


}

public function build()
{
    return $this->view('mail.activation')
              ->from([email protected]')
              ->with([
                'site' => $this->site,
                'activation' => $this->activation,
                'username' => $this->username,
                'test' => 'My Test Val'
              ]);
}

Then finally, the template looks like any normal blade template complete with {{$activation}} style variables. The mail is sent perfectly but it sends the email without being parsed, so the variables are still in the file.

richtestani
richtestani
  • 2 weeks ago