How can I properly pass data into a view intended for html email template in Codeigniter4?

  codeigniter-4, php

I am trying to pass data into a view from which contents will be sent as an html email. The view file is loading properly and email delivers except that it doesn’t show the data I have passed alongside.

Below is the code



$content = '<p style="font-size: 14px; line-height: 140%; text-align: center;"> <span style="font-size: 16px; line-height: 22.4px;"> This is a content to be passed </span> </p>';
$item = [
    'title' => 'This is an amazing title',
    'message' => $content
$message = view('email_template', $item); //email_template is a view that loads fine but the $item is not accessed inside of it.



<!DOCTYPE html>

<?php print_r($item) ?>


Source: Ask PHP