Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Forgot password mailer not working

Participant ,
Mar 16, 2012 Mar 16, 2012

Can any one see wha't worng here.

This piece of code should return the users password by email but the email arrives successfully without any password.

The email is sucessfully passed as $_POST['email'] as it is used as the email address for the email sent so something else msut be wrong>

Any ideas?

***********************************

$email = $_POST['email'] ;

 

$sql = mysql_query("SELECT email, password FROM users where email = '$email'")

or die(mysql_error()); 

$row = mysql_fetch_array($sql);

$rownum = mysql_num_rows($sql);

$to= $row['email'];

$subject= "Your login details";

if(!$rownum  ) {

echo "<H3>Sorry, that email address does not match our records</H3>";

}

if($rownum ==1  ){

$message   .= "Your password is:\n\n".$row['password']."\n\n

 

To sign-in click here http://www.mysite.com/admin/sign-in.php";

     

$header = "From: support@mysite.com.com";    

    

$sent =  mail($to,$subject,$message,$header);

if($sent)

{

print "<H3>Your password has been sent to your e mail address</H3>" ;

}

}

***********************************

TOPICS
Server side applications
773
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 16, 2012 Mar 16, 2012

Show us what the contents of the email actually look like.

>$message   .= "Your password is:\n\n".$row['password']."\n\n

Looks like you're missing the closing double quote.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 21, 2012 Mar 21, 2012

Are you seeing "Your password has been sent to your e mail address" message?

It can be a lot of things.

Some servers (recipient side) will accept emails with proper headers only.

You are sending the email as user "nobody". Your server might be set to prevent to send emails as nobody which requires you to send it via SMTP connection.(you can ask your host about this)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 21, 2012 Mar 21, 2012
LATEST

Burak, the OP mentioned that the email arrives, but the content is not as expected. So it sounds like something malformed in the $message string.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines