I want to know if it's possible to insert inline php code in an html messege send by a php form e-mail script. I got the beef of this script online (it's not the final one I'll use I'm just using it to help learn php)
but I want to send an html e-mail but I want to be able to echo variables in the html. this is what i've tried so far. also am I doing the POST wrong because that doesn't show in the e-mail either.
<?php $to="firstname.lastname@example.org"; $from=$_POST["email"]; $subject="My first HTML E-mail"; $msg=$_POST["message"]; $message= '<h1>HTML E-mail</h1> <p>This is an <b>HTML</b> e-mail.</p> <p>try to put php in the html php page?!?!? <?=$subject?> </p> '; $headers = "MIME-Version: 1.0\r\n"; $headers.= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers.= "From: $from\r\n"; if (mail($to, $subject, $message, $headers)) echo "Message Sent!"; else echo "Failed to send message."; ?>I got the $subject in the html now becasue the POST won't work (do I need a single quote instead of a double?) but I eventually want to send what people write in a comment box.
the html works but the php in the html doesn't show
the main reason for this is formatting so It's pretty and easy to read when I get the results of a form