'php html email missing variable data

I am sending a php email with script inside an html body. When the message is sent the echo output shown in the script below displays to the screen nicely, but it is missing from the email body received.

How can I include this section in my email?

This is the code I am using

// Put your HTML here
$message = file_get_contents('.message_update.html');
echo $message;
$Date = date('d/m/Y');
$count = 0;

$new_dir = str_replace('_', ' ', $dir);
echo "<font color='blue'>";
echo "The folder name at the website message page is: ", 
$new_dir."<br /></font>";
$message .= 'The folder name at the website message page is: ", 
$new_dir."<br /></font>';
$comparison = array_diff($list2, $list1);

foreach ($comparison as $line) {
echo "Date Update: ", $Date, " : To listen to the ", ++$count, " 

message click the picture
here ";

echo '<a href="' . $folder_path, $line . '"><img align="top" 
width="100" height="20"  text-    
align: center; 
src="https://nerjabible.com/images/audio_player1.png" /></a>';
echo ", The ", $count, " message name is entitled:    ", $line. " 
<br />";
}

$message = file_get_contents('.message_update1.html');
echo $message;

// Mail it`

` The output of the first html file .message_update.html is included in top of the email received. Then the variables from the script are missing The output of the second .message_update1.html is included at the bottom of the email received.

How can I wrap this section

$new_dir = str_replace('_', ' ', $dir);
echo "<font color='blue'>";
echo "The folder name at the website message page is: ", 
$new_dir."<br /></font>";
$message .= 'The folder name at the website message page is: ", 
$new_dir."<br /></font>';
$comparison = array_diff($list2, $list1);

foreach ($comparison as $line) {
echo "Date Update: ", $Date, " : To listen to the ", ++$count, " 
message click the picture    
here ";

echo '<a href="' . $folder_path, $line . '"><img align="top" 
width="100" height="20"  text-    
align: center; 
src="https://nerjabible.com/images/audio_player1.png" /></a>';
echo ", The ", $count, " message name is entitled:    ", $line. " 
<br />";
}

and include it in the $message variable?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source