I am trying to send an email to the user for password recovery. The code below allows me to send user information to user_Email. I was able to echo success but the issue here is that I am not receiving the mail from the mail.php. This mail is being setup in a hosting site called bluehost
<?php
    include("connection.php");
    require 'mail.php';
    if (isset($_POST['submit'])) {
        $user_Email = $_POST['email'];
        $select = $_POST['option'];
        $pin = $_POST['pin'];
        if (!empty($user_Email) && !empty($pin)) {  
            $reco = "SELECT * FROM tablename WHERE user_Email = '$user_Email' AND user_Pin = '$pin'";       
            $result = $MySQLi_CON->query($reco);
            foreach ($result as $key ) {
                $name = $key['user_Name'];
                $email = $key['user_Email'];
                $password =$key['user_Pass'];
                $pin = $key['pin'];
            }
            email($name, $email, $password, $pin);
        }
    }
?>
mail.php
<?php
    function email($name, $email, $password, $pin){     
        $to      = $email;
        $subject = "Password recovery";
        $message = "Hello";
        $headers = 'From:'. "\r\n" ."CC: someone@gmail.com";    
        $mail = mail($to,  $subject, $message,  $headers);
        if($mail){
            echo "success";
        }else{
            echo "fail";
        }
    }
?>