I'm trying to improve the way I email form submissions using PHP. At the moment my code looks like this:
<?php
//==== FORM DATA
$name = $_REQUEST['cName'];
$email = $_REQUEST['cEmail'];
$message = $_REQUEST['cMessage'];
//==== EMAIL DETAILS
$to = "myemailaddress@test.com";
$subject = "Web Query";
$headers .= "From:".$email;
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
//==== EMAIL CONTENT
$content =
"<b>From: </b>".$name."<br />".
"<b>Email: </b>".$email."<br /><br />".
"<b>Message: </b>".$message;
//==== SEND EMAIL
mail($to, $subject, $content, $headers);
?>
There's one potential flaw I've spotted in the way I do it. I put in the 'to' email address and I'm worried that might lead to spam (all other data comes from the html form submission except the 'to' address which is straight into the PHP). What is the easiest way to obfuscate that email address and is it neccessary to do so?