Hello Friends
I written the the code for forgetpassword
in this i have to get the mail when i enter the mailid
the code is as follows
forgetpasswd.php
<form name="f1" method="POST" action="retrieve.php" >
<table>
<tr><td colspan=3> </td></tr>
<tr><td colspan=3> </td></tr>
<tr>
<td><font color="red">*</font>Enter Email-ID</td>
<td>:</td>
<td><input type="text" name="email" maxlength=50></td>
<td></td>
<td><input type="submit" value="GO">
</tr>
</table>
</form>
retrieve.php
<?php
//getting email value from form forgotPwd.php
$email = $_POST["email"];
//connection to database and select database
//include("..\\all\\dbconnection.php");
include("dbconnection.php");
//include_once("../all/dbconnection.php");
if($_SERVER['REQUEST_METHOD']=='POST' ){
$frq="select * from md_users where EmailId='".$_POST['EmailId']."'";
$fres=mysql_query($frq);
$frcnt=mysql_num_rows($fres);
if($frcnt==1){
$frow=mysql_fetch_assoc($fres);
}
/*//Query to get Login and Password from logindetails table.
$result = mysql_query("select * from clientmaster1 where email='".$email."' and actstatus='1' ");
//checking execution
if(!$result)
echo mysql_error();
while($row=mysql_fetch_array($result))
{
$login =$row[""];
$loginid=$row["loginid"];
$pwd=$row["pwd"];
$name=$row["name"];
$doc=$row["doc"];
}
*/
//mail
include( "Mail.php");
$from = "admin@website.com";
$to = $email;
$subject = "Forgot Password!";
$body = "Dear ".$frow['EmailId']."\nCongratulations!!\nWelcome to roamkerala\nDetails Of Login Registration\nLogin : ".$loginid."\nPassword : ".$frow['Password']."\nYour Profile created on ".$doc;
//$host = "mail.vkcitycourier.com";
$host = "mail.website.com";
$username = "admin@website.com";
$password = "adminpassword";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers,$body);
if (PEAR::isError($mail))
{
echo("<p>" . $mail->getMessage() . "</p>" ."your password send to you");
}
else
{
$err="Login ID and Password has sent successfully to email";
}
}
?>
The code is working in locally fine
but when i upload this file on server it is not working(the mail is not comming )
can any one please resolve this issue
Thanking u