<?php

if($_SERVER['REQUEST_METHOD']=='POST'){


$to_email=$_POST['to_email'];
$from_email=$_POST['from_email'];
$code=$_POST['code'];
  $messages = array();

$to = $to_email;
$subject = "Forgot password";
$txt = "Thank you for registering with tempnumber \n Verfication Code= $code ";
$headers = 'From: $from_email' . "\r\n" .
'Reply-To: $from_email' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
if(mail($to,$subject,$txt,$headers)){
   
   // $messages["data"] = array();
  $messages["sent"] = "yes";

  
    
    


  

        //array_push($messages, $p);
    

    echo json_encode($messages);
}else{
     $messages["sent"] = "no";

  
    
    


  

        //array_push($messages, $p);
    

    echo json_encode($messages);

}
}
else{
echo "Error";
}
?>