Skip to content Skip to sidebar Skip to footer

HTML Form With Sendemail

I can’t figure out where the problem comes from! The mail() is working perfectly (I already tested it with a simple php file) but my form doesn’t send any email! HTML

Solution 1:

I think Headers needs to be a string.

$headers  = '';
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\r\n";
$headers .= "From: {$name} <{$from}>\r\n";
$headers .= "Reply-To: <{$from}>\r\n";
$headers .= "Subject: {$subject}\r\n";
$headers .= "X-Mailer: PHP/".phpversion() . "\r\n";

http://php.net/manual/en/function.mail.php

You should also filter $_POST

http://php.net/manual/en/function.filter-input.php

I think you also need to send the data through the ajax request.

$.ajax({
  url: $(this).attr('action'),
  type: "POST",
  data: $(this).serialize(),

Post a Comment for "HTML Form With Sendemail"