0

Ok so i've got this form on my index.html page:

  <form method="post" action="contact.php">
  <div class="row uniform 50%">
    <div class="6u 12u$(xsmall)">
      <input type="text" name="name" id="name"
        value="" placeholder="Name / Company Name" required />
    </div>
    <div class="6u$ 12u$(xsmall)">
      <input type="email" name="email" id="email" value="" placeholder="Email" required />
    </div>
  </div>
  <br>
  <div class="12u$">
    <textarea name="message" id="message" placeholder="Enter your message" rows="6" required></textarea>
  </div>
  <br>
  <div class="12u$">
    <ul class="actions">
      <li>
        <input type="submit" value="Send Message" class="special" /></li>
      <li>
        <input type="reset" value="Reset" /></li>
    </ul>
  </div>  
  </form>

And this contact.php page which is supposed to send the email with the data from the HTML form to my email:

<?php
if(isset($_POST['submit']))
{
$name=$_POST['name'];
$email=$_POST['email'];
$message=$_POST['message'];
$mail_to='my@email.com';             -> hid it for privacy
$mail_subject='New submission from the Contact Form';
$mail_body="From: $email\n Name: $name\n Message:\n $message";
$header = "Content-type: text/html\n";
mail($mail_to, $mail_subject, $mail_body, $header);
}

      header('Location: thankyou.html');
             exit;
?>

For some reason the php script is not sending any email to the targeted email address. The server is configured fine, i ran a testmail.php script that succesfully sent the mail to the target. Any help would be appreciated.

HashPsi
  • 1,391
  • 2
  • 12
  • 22
syned
  • 1
  • 1
  • 1
    Can you try putting this: `header('Location: thankyou.html'); exit;` inside the `if (isset)` statement and see if that works ? – Maximus2012 Sep 02 '15 at 19:23
  • You might also want to comment out the redirection code for testing purpose and see if the email goes through then. – Maximus2012 Sep 02 '15 at 19:24
  • Thank you for your answer! I tried both your suggestions but it still does not work. – syned Sep 02 '15 at 19:51

0 Answers0