I'm trying to send to the user welcome message after registration, but it did not send anything to the email, but the data is inserted in the database can you please help me figure out what is wrong with my code
$email = $_POST['email'];
$query2 = mysql_query("INSERT INTO facultymember (pin,ID,firstname,midname,lastname,phone,email,password,Door_Num) Values('".$_POST["type"]."','".$_POST["FMID"]."','".$_POST["firstname"]."','".$_POST["middlename"]."','".$_POST["lastname"]."','".$_POST["phone"]."','".$_POST["email"]."','".$_POST["password"]."','".$_POST["Door_NUM"]."')", $connection);
$message = "Add Successfully";
if($query2)
{
$subject = "Email Verification mail";
$headers = "From: email@domain.com \r\n";
$emessage = "welcome";
mail($email,$subject,$emessage,$headers);
}