title: Using wp_mail() instead of mail() in Wordpress does not work
body: <p>Since PHP mail has been disabled on my server it has stopped a theme integrated contact form from working.</p>
  
  <p>The theme is called Boldy and it has its own sendmail.php file which uses <code>mail()</code> instead of <code>wp_mail()</code>.</p>
  
  <p>Changing <code>mail()</code> to <code>wp_mail()</code> does not work, but I'm not sure why?</p>
  
  <pre><code>&lt;?php
  if (isset($_POST['submit']))
  {
      error_reporting(E_NOTICE);
  
      function valid_email($str)
      {
          return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $str)) ? FALSE : TRUE;
      }
  
      if ($_POST['name'] != '' &amp;&amp; $_POST['email'] != '' &amp;&amp; valid_email($_POST['email']) == TRUE &amp;&amp; strlen($_POST['comment']) &gt; 1)
      {
          $to = preg_replace("([\r\n])", "", $_POST['receiver']);
          $from = preg_replace("([\r\n])", "", $_POST['email']);
          $subject = "Website contact message from ".$_POST['name'];
          $message = $_POST['comment'];
          $match = "/(bcc:|cc:|content\-type:)/i";
  
          if (preg_match($match, $to) || preg_match($match, $from) || preg_match($match, $message))
          {
              die("Header injection detected.");
          }
  
          $headers = "From: ".$from."\r\n";
          $headers .= "Reply-to: ".$from."\r\n";
  
          if (mail($to, $subject, $message, $headers))
          {
              echo 1; //SUCCESS
          }
          else
          {
              echo 2; //FAILURE - server failure
          }
      }
      else
      {
          echo 3; //FAILURE - not valid email
      }
  
  }
  else
  {
      die("Direct access not allowed!");
  }
  ?&gt;
  </code></pre>