I tried about a million things on the internet to get this working but I am just stumped. I can't figure out why it doesn't send a mail anymore.
It gives an alert just like a wanted it to do, but the mail doesn't send to my email.
Here is my code:
<script>
$(document).ready(function(){
$("#contact-form").on("submit", function(e){
e.preventDefault();
dataString = jQuery('form#contact-form').serialize();
jQuery.ajax({
type: "POST",
url: "mail.php",
data: dataString,
success: function(data)
{
alert('Form successfully submitted.');
},
error: function(data)
{
}
});
});
});
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form id="contact-form" name="contactform" method="POST">
<input contenteditable="true" style="width:68%;" maxlength="32" placeholder="" class="contact_input" name="name" id="naam" required/></h2>
<input contenteditable="true" style="width:100%;" maxlength="512" placeholder="" class="contact_input" name="message" id="onderwerp" required/></h2>
<input contenteditable="true" maxlength="50" style="width:47.5%;" placeholder="" class="contact_input" name="email" id="contact1" required/> en
<input contenteditable="true" maxlength="50" style="width:92.7%;" placeholder="" class="contact_input" name="contact2" id="contact2"/></h2>
<h3><input type="submit" id="submit-button" value="groetjes" class="btn btn-primary"></h3>
</form>
Mail.php
<?php
$name = $_POST['name'];
$contact1 = $_POST['email'];
$contact2 = $_POST['contact2'];
$inhoud = $_POST['message'];
$to = "";
$subject = "Contactform";
$from = "";
$message = "";
$headers = "From:" . $from;
mail($to, $subject, $message, $headers);