title: PHP Email contact-form
body: <p>I've recently started using HTML, Javascript and PHP to create my own website.
  I have been trying to make a PHP script that takes inputs from a form, validates with javascript and php, then sends the email.
  I know the script is executed and runs fine, as it sucessfully redirects me to the new page at the end. However, it does not actually send any emails for some reason. 
  Here is the code:</p>
  
  <pre><code>&lt;?php
    $errors = '';
    $myemail = '&lt;removed due to privacy&gt;';
    if(empty($_POST['name'])  ||  empty($_POST['email']) ||  empty($_POST['message']))
    {
      $errors .= "\n Error: all fields are required";
    }
  
    $name = $_POST['name']; 
    $email_address = $_POST['email']; 
    $message = $_POST['message']; 
  
    if (!preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i", $email_address))
    {
      $errors .= "\n Error: Invalid email address";
    }
  
    if( empty($errors))
    {
      $to = $myemail;
  
      $email_subject = "Contact form submission: $name";
  
      $email_body = "You have received a new message. ".
  
      " Here are the details:\n Name: $name \n ".
  
      "Email: $email_address\n Message \n $message";
  
      $headers = "From: $myemail\n";
  
      $headers .= "Reply-To: $email_address";
  
      mail($to,$email_subject,$email_body,$headers);
  
      //redirect to the 'thank you' page
  
      header('Location: contact-form-thank-you.html');
  
    }
  ?&gt;
  </code></pre>
  
  <p>Now I did see a few similar questions, but as I am very incompetent at php, they didn't really help.
  If you can identify the reason, I'd be very grateful.</p>