0

My website is hosted on a live server with Tsohost. I am using PHP mail function to send emails, however my following mail function does not work in my code but everything else does. How can i try implement this feature.

  <?php include "resources/configuration/config.php"; ?>

   <?php


  if(isset($_POST['btnRecover'])) {


   $Email = $_POST['Email'];


    $query = "SELECT * FROM users WHERE Email = '{$Email}'";

    $query = mysqli_query($connection, $query);

       $numrow = mysqli_num_rows($query);


      if($numrow != 0) {

      while($row = mysqli_fetch_assoc($query)) {

          $db_email = $row['Email'];

                }

              if($Email == $db_email) {

          $code = rand(1000, 1000000);

          $to = $db_email;

          $subject = "Password Reset";

            $body = "This is an automated email. Please DO NOT reply to  this. Click the link below or paste it into your browser http://www.castlewellanforestpark.com/recover_password.php?code =$code&email = $Email ";

          }

              $query1 = "UPDATE users SET passreset ='{$code}' WHERE Email = '{$Email}'";

                $query1 = mysqli_query($connection, $query1);

                 mail($to, $subject, $body);

                  echo "Check Your Email";

                      } 


                       else {

                          echo "That Email does not exist";

                            }



                               }


                                   ?>
steve
  • 57
  • 1
  • 7

0 Answers0