ob_start();
//stuff output to browser
$message = ob_get_contents(); ob_clean(); echo $message; //this can be emailed