For sure a problem where you placed the code.
You deleted some stuff that should not be deleted
Default code ahould be
/* PHP CODE HERE */
/* BODY HERE */
$body = <<<EOF
EOF;
Do not delete the EOF stuff
Place yor HTML after <<<EOF and before EOF;
This may help you
Here and