title: Trouble with HTML Contact Form PHP Not Sending Emails to Gmail
body: <p>I've created a simple contact form that should be sending emails via php to me however, when I attempt to send/submit the form I continue to get the &quot;message failed&quot; output and have confirmed nothing is coming to my gmail inbox.</p>
  <p>I have gone into my host server (heartland) and tried updating the Php.ini Port to (25 and 2525) and changed my SMTP to the host mail server. I've checked my error log and resolved any errors reported on it. I'm unsure if the issue lies within my host server or my actual php/form code.</p>
  <p><strong>Form Code</strong></p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;h2&gt;Contact Form&lt;/h2&gt;
  &lt;form id="contactForm" method="POST" action="formHandler.php"&gt;
    &lt;div class="row"&gt;
      &lt;div class="col-md-6"&gt;
        &lt;div class="form-group"&gt;
          &lt;input type="text" class="form-control" id="name" name="name" placeholder="Name" required data-error="Please enter your name"&gt;
          &lt;div class="help-block with-errors"&gt;&lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="col-md-6"&gt;
        &lt;div class="form-group"&gt;
          &lt;input type="text" placeholder="Email" id="email" class="form-control" name="email" required data-error="Please enter your email"&gt;
          &lt;div class="help-block with-errors"&gt;&lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="col-md-12"&gt;
        &lt;div class="form-group"&gt;
          &lt;input type="text" placeholder="Subject" id="msg_subject" class="form-control" required data-error="Please enter your subject"&gt;
          &lt;div class="help-block with-errors"&gt;&lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="col-md-12"&gt;
        &lt;div class="form-group"&gt;
          &lt;textarea class="form-control" id="message" name="message" placeholder="Your Message" rows="5" data-error="Write your message" required&gt;&lt;/textarea&gt;
          &lt;div class="help-block with-errors"&gt;&lt;/div&gt;
        &lt;/div&gt;
        &lt;div class="submit-button"&gt;
          &lt;button class="btn btn-common" id="submit" type="submit" value="submit" target="_blank"&gt;Send Message&lt;/button&gt;
          &lt;div id="msgSubmit" class="h3 text-center hidden"&gt;&lt;/div&gt;
          &lt;div class="clearfix"&gt;&lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>
  <p><strong>PHP  Code</strong></p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php
  
  if(isset($_POST['submit'])){
  
  $to = "myemail@gmail.com";
  $name = $_POST['name'];
  $email = $_POST['email'];
  $message = $_POST['message'];
  
  $formcontent=" From: $name \n Email: $email \n Message: $message";
  
  $subject = "Contact Form";
  
  $mailheader = "From: $email \r \n";
  
  mail($to, $mailheader, $subject, $formcontent);
  
  echo "&lt;p&gt;Thank you for contacting me!&lt;/p&gt;";
  echo "&lt;p&gt;I will reply to your inquiry in 24-48 business hours.&lt;/p&gt;";
  echo "&lt;a href='form.html' style='text-decoration:none;color:#ff0099;'&gt; Return Home&lt;/a&gt;";
  
  } 
  else{
      echo "&lt;p&gt; Message Failed to Send.&lt;/p&gt;";
    echo "&lt;a href='form.html' style='text-decoration:none;color:#ff0099;'&gt; Return Home&lt;/a&gt;";
  }</code></pre>
  </div>
  </div>
  </p>