I'm trying to send an email confirmation to my email address (admin) after a user is registered into this form! Please how can i configure my sendmail?I'm using Xampp.The code works correctly and the message
The email has been sent
is displayed but when opening my email address which is included into $to variable there is not any email in  inbox. This is my code:
<html >
<head>
<title></title>
</head>
<body>
<?php
print ("<form action='register.php' method='post'>
    <p>Name
        <input type='text' name='firstname'  />
    </p>
    <p>Surname
        <input type='text' name='lastname' />
    </p>
    <p>Username
        <input type='text' name='username' />
    </p>
    <p>Password
        <input type='password' name='password' />
        </p>
        <p>Email <input type='text' name='email'/>  </p>
      Enter your CV: <p> <textarea name='cv' cols='60' rows='50'></textarea> </p>
  <input type='submit'  value='Register'/>  
</form>
        ");
if( !($database=mysql_connect("localhost","root",""))||!(mysql_select_db("st_login",$database))  )
   print("Could not connect");
if(isset($_POST['firstname'] )&&isset($_POST['lastname'])&&isset($_POST['username'])&&isset($_POST['password'])
  &&isset($_POST['cv'])/*&&isset($_POST['notat'])&&isset($_POST['lendet'])*/&&isset($_POST['email'])){
$firstname=$_POST['firstname'];
$lastname=$_POST['lastname'];
$username=$_POST['username'];
$password=$_POST['password'];
$email=$_POST['email'];
$cv=$_POST['cv'];
/*
$notat=$_POST['notat'];
$lendet=$_POST['lendet'];
*/
$query = "INSERT INTO  login (firstname, lastname, username,password,cv,email) VALUES ('$firstname', '$lastname',
 '$username','$password','$cv','$email')";
}
if ( !empty($firstname)&&!empty($lastname)&&!empty($username) &&!empty($password)&&!empty($cv)&&!empty($email))
{
  if(!($result=mysql_query($query,$database)))
{
    print("Could not execute query");
    die (mysql_error());//ose error
}
$to='backa.elda123@gmail.com';
$subject='Asking for permission';
$body='There is another registered student waiting for your approval!';
$headers='From:<arbi.backa@gmail.com>';
if(mail($to,$subject,$body,$headers)){
  echo "mail sent to..";}
  else echo'errorr sending the email';
echo "YOU HAVE BEEN REGISTERED SUCCESSFULLY!PLEASE WAIT FOR THE ADMIN APPROVAL!";
}
else echo "Fill in all the blank fields";
mysql_close($database);
?>
</body>
</html>
 
     
    