title: Secure php email script
body: <p>I want to use a php script to send emails from a html file on a website.
  Would this php script be secure enough against hacking and spam?</p>
  
  <pre><code>&lt;?php 
  
  $to = "emailto@site.com";
  $subject = "Sent from site";
  
  $email = $_POST['emailFrom'];
  $message = $_POST['message'];
  
  $email   = filter_var($email , FILTER_SANITIZE_EMAIL);
  $message = filter_var($message , FILTER_SANITIZE_EMAIL);
  
  $message = $email . $message;
  
  mail($to, $subject, $message, "From: webpage@site.com");
  ?&gt;
  </code></pre>