Nothing happens when I click the button send, hope you will help me to find a solution. In my php.ini, I just changed the email
[mail function]
; XAMPP: Comment out this if you want to work with an SMTP Server like Mercury
; SMTP = localhost
; smtp_port = 25
; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = myemail@yahoo.fr
forgotPassword.php
<div>
<div>
<div>
<input type="email" class="form-input" id="email" placeholder="Your email">
</div>
</div>
<div>
<input type="submit" class="btn-reset" value="Send">
</div>
<p id="response"></p>
</div>
<script>
var email = $("#email");
$(document).ready(function()
{
$(".btn-reset").on('click', function()
{
if(email.val() != "")
{
email.css('border', '1px solid dodgerblue');
$.ajax(
{
url: 'forgotPassword.php',
method: 'POST',
dataType: 'json',
data:
{
email: email.val()
},
success: function (response)
{
if(!response.success)
{
$("#response").html(response.msg).css('color', 'red');
}
else
{
$("#response").html(response.msg).css('color', 'green');
}
}
});
}
else
{
email.css('border', '1px solid red');
}
});
});
</script>
In the same page
$query = mysql_query('SELECT * FROM user WHERE email = "'.$email.'"')or die(mysql_error());
if(mysql_num_rows($query) > 0)
{
require_once "PHPMailer/PHPMailer.php";
require_once "PHPMailer/Exception.php";
$mail = new PHPMailer();
$mail->addAddress($email);
$mail->setFrom("myname@yahoo.fr", "ME");
$eail->Subject = "Email";
$mail->isHTML(true);
$mail->Body = "
Hi my friend!
";
if($mail->send())
{
exit(json_encode(array("status" => 1, "msg" => "Email sent! ")));
}
else
{
exit(json_encode(array("status" => 0, "msg" => "Error sending mail")));
}
}
else
{
exit(json_encode(array("status" => 0, "msg" => "Check your email")));
}