In my website we have a option for forgot password.If any client enters their registered email id and submits the form then the password will go to that particular registered email id it worked before but now same code is not working .

If the client email id is gmail id or yahoo id then the password is not going to their email id.

For testing in maill() i have changed TO from gmail id into my company email id(example : admin@companyname.com) then i clicked submit in that case I received password and other details to my company id.

Can anyone tell me why my mails are not going to gmail or yahoo id's ?but the same code is working if i give my company email id.

I have pasted code here,

ini_set('SMTP', 'mailserver01.manashosting.net'); //Suggested by "Some Guy"
ini_set('SMTP_port', 25); //Suggested by "Some Guy"
PHP Code:
$user_email   ="xxx@gmail.com";
$query "select user_name,user_pass,user_id from users where user_email = '$user_email'";
//execute the SQL statement
$q1mysql_query($query) or die("Error in Query ".$query);
$num mysql_num_rows($q1);
$i 0;
$i $num)
$user_name   mysql_result($q1,$i,"user_name");
$user_pass   mysql_result($q1,$i,"user_pass");
$user_id   mysql_result($q1,$i,"user_id");
$i $i 1;


$name1 "Admin";
$message "".$name.",\n";
$message1 ="Please find your login details below,\n";
$message2 ="Use your username or email id to login,\n";

$mail_body .= "".$message."\n"//mail body
$mail_body .= "".$message1."\n"//mail body
$mail_body .= "".$message2."\n"//mail body
$mail_body .= "User Name :".$name."\n"//mail body
$mail_body .= "Your Email-Id :".$user_email."\n"//mail body
$mail_body .= "User Id :".$user_id."\n"//mail body
$mail_body .= "Password :".$user_pass."\n"//mail body
$recipient "xxx@gmail.com; //recipient

// checking the mode either add or modify

    //declare the SQL statement that will query the database
    //declare the SQL statement that will query the database
$subject = "Cismak Login details"; //subject
$header = "From". $name1 . " <" . $email . ">\r\n"; //optional headerfields

$recipient$subject$mail_body$header); //mail command :)