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
<?php $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> <html> <head> <title>Sample</title> </head> <body> <?php print_r($item) ?> </body> </html>
Source: Ask PHP