I have PHP file for make table with data row from database . I want send this page to email . but when I get content contains HTML and PHP code . but I want send only result of page in HTML.
i use this code
    $str =  file_get_contents( 'template.php' );
    $mail = "[email protected]";
    mail($mail,$str);
and this
$str = readfile("'template.php'");
but result contains php code in email . how i can get only html result?
function getRenderedHTML($path)
{
    ob_start();
    include($path);
    $var=ob_get_contents(); 
    ob_end_clean();
    return $var;
}
This function will do what you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With