سلام
قسمتی برای بازگرداندن پسورد کاربر از طریق ایمیل در سایت ایجاد کردم اما ایمیل ارسال نمی شود.
این کدها:
تشکر
قسمتی برای بازگرداندن پسورد کاربر از طریق ایمیل در سایت ایجاد کردم اما ایمیل ارسال نمی شود.
این کدها:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | //receive user if (isset( $_POST [ 'sub_receive_pass' ]) && ! empty ( $_POST [ 'txtEmail' ])) { $email = htmlentities( $_POST [ 'txtEmail' ]); $safe_email = mysqli_real_escape_string( $conn , $email ); //search pass $sel_user = "select * from users where u_email = '$safe_email'" ; $run_user = mysqli_query( $conn , $sel_user ); $check_user = mysqli_num_rows( $run_user ); $main_email = "" ; if ( $check_user > 0) { mysqli_set_charset( $conn , "utf8" ); $sql = "SELECT * FROM users where u_email = '$safe_email'" ; $result = mysqli_query( $conn , $sql ); while ( $row = mysqli_fetch_assoc( $result )) { $main_email = $row [ "u_email" ]; $pass = $row [ "u_pass" ]; //send email $headers = "MIME-Version: 1.0" . "rn" ; $headers .= "Content-type:text/html;charset=UTF-8" . "rn" ; // More headers $headers .= 'From: <webmaster@example.com>' . "rn" ; $headers .= 'Cc: myboss@example.com' . "rn" ; $subject = "Password key" ; $descrip = "" ; //mail("payam.hayati@yahoo","$subject","$descrip","From : $email","$headers"); mail( "$main_email" , "$subject" , "$descrip" , "Password : $pass" , "$headers" ); echo "<script>alert('Password sent to your email')</script>" ; echo "<script>window.open('forget.php', '_self')</script>" ; return ; } } else { echo "<script>alert('This email is not registered in the system!')</script>" ; echo "<script>window.open('forget.php', '_self')</script>" ; } } if (isset( $_POST [ 'sub_receive_pass' ]) && empty ( $_POST [ 'txtEmail' ])) { echo "<script>alert('Enter your email address')</script>" ; echo "<script>window.open('forget.php', '_self')</script>" ; } |