This question already has answers here:
</div>
</div>
<div class="grid--cell mb0 mt4">
<a href="/questions/24644436/php-mail-function-doesnt-complete-sending-of-e-mail" dir="ltr">PHP mail function doesn't complete sending of e-mail</a>
<span class="question-originals-answer-count">
(26 answers)
</span>
</div>
<div class="grid--cell mb0 mt8">Closed <span title="2017-02-20 19:11:24Z" class="relativetime">3 years ago</span>.</div>
</div>
</aside>
I have a problem this PHP send mail.
I have this form in index.php page:
<form action="">
<input placeholder="Name" class="form" id="name" type="text" required/>
<input placeholder="Email" class="form" id="mail" type="email" required />
<input placeholder="Object" class="form" id="object" type="text" required />
<textarea placeholder="Type here..." id="text" class="form"></textarea>
<input class="formBtn" type="submit" id="submit"/>
<input class="formBtn" type="reset" />
This script on bottom of the index.php
<script>
$('#submit').click(function() {
var nameform = $('#name').val();
var mailform = $('#mail').val();
var objectform = $('#object').val();
var textform = $('#text').val();
var mailcomplete = 'Name='+nameform+'Mail='+mailform+'Object='+objectform+'Message='+textform;
$.ajax({
type: "POST",
url: 'php/mail.php',
data: mailcomplete,
success: function() {
alert("Mail send OK!");
}
});
});
and this in php/mail.php
<?php
$name = $_POST["nameform"];
$mail = $_POST["mailform"];
mail($mail, $name, "Hello!");
?>
But don't work... Can you help me? Tnk
</div>