i created a forgot password. It checks if the email is existing or not in the database and it creates an activiation code. However, i dont receive any mail from the email i typed. Do i have to install something to make this work? if you found this as duplicate, it is not because others who posted this forgot password is working for them, but in my case i dont receive emails.
Here is the code:
<?php
error_reporting(0);
if($_POST['submit']=='Send')
{
//keep it inside
$email=$_POST['email'];
$code = $_GET['activation_code'];
$con=mysqli_connect("localhost","root","","test");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$query = mysqli_query($con,"select * from users where user_email='$email'")
or die(mysqli_error($con));
if (mysqli_num_rows ($query)==1)
{
$code=rand(100,999);
$message="You activation link is: http://192.168.0.108/resetpass.php?email=$email&code=$code";
mail($email, "daleii.calderon@yahoo.com", $message);
echo 'Email sent';
$query2 = mysqli_query($con,"update users set activation_code='$code' where user_email='$email' ")
or die(mysqli_error($con));
}
else
{
echo 'No user exist with this email id';
}}
?>
<form action="forgot.php" method="post">
Enter you email ID: <input type="text" name="email">
<input type="submit" name="submit" value="Send">
</form>