Hi Can any One Help me in Sending e mail .
I am creating code for Forget password where iam sending the password to those eho forget based on their Email iD. It Partially works but Sends Error as
Cannot send password to your e-mail address ie error 3
and my code is
<?$email=mysql_real_escape_string($_POST['email_to']);
$sql="SELECT `user_pass` FROM tbl_user WHERE
user_email='".$email."'";
$result=mysql_query($sql,$con);
$count=mysql_num_rows($result);
if (isset($_POST['Submit']))
{
if($email == "")
{
$error ="Enter Email";
}
elseif($count==1){
$row=mysql_fetch_array($result);
{
$password = $row['user_pass'];
}
$to=$email;
$subject="Your password here";
$header="from: B2Bassociates";
$messages= "Your password for login to our website \r\n";
$messages.="Your password is $password \r\n";
$messages.="more message... \r\n";
$sentmail = mail($to,$subject,$messages,$header);
}
else {
$error1 = " Not Found ";
}
if($sentmail){
$error2 = "Your Password Has Been Sent To Your Email Address.";
}
else {
$error3 = "Cannot send password to your e-mail address";
}
}
?>