http://php.flashwebhost.com/sherly/lost_password.html

The password has been sent to the e-mail address specified

Code:
<?php

include "includes/database.php"; 

if (isset($_POST['email'])) {    
   $email = $_POST['email'];
} else {    
   die('Please enter your email address');
}

$email = trim($email);

$sql = "select * from users where email='$email'";

$result = $mysqli->query($sql);

if ($result->num_rows == 0) {    
die("User with email address <b>$email</b> not found");

}
$userInfo = mysqli_fetch_assoc($result);

$name = $userInfo['name'];
$password = $userInfo['password'];
mail($email,"Your password", "Hello $name, your password is $password");
echo 'The password has been sent to the e-mail address specified';