I am trying to send an email using php but unable to do it, whereas I am getting data into MySQL database.
I have posted my whole code, please check and let me know where's the mistake.
$objConnect = mysql_connect("localhost","username","pwd");
$objDB = mysql_select_db("database");
$strName = $_POST["name"];
$strEmail = $_POST["email"];
$to      = $strEmail;
$subject = 'the subject';
$message = 'hello';
$headers = 'From: mymail@gmail.com' . "\r\n" .
'Reply-To: mymail@gmail.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
$strSQL = "insert into data (name, email) VALUES ('".$strName."','".$strEmail."')";
$objQuery = mysql_query($strSQL);
if(!$objQuery)
    {
        $arr['StatusID'] = "0"; 
        $arr['Message'] = "Cannot save data!";  
    }
    else
    {
        mail($to, $subject, $message, $headers);
        $arr['StatusID'] = "1"; 
        $arr['Message'] = "Data saved successfully";    
    }
    mysql_close($objConnect);
    echo json_encode($arr);
 
     
     
    