Enviar correo php al usuario si se envía el formulario

Estoy tratando de usar la función phpmail para enviar un correo electrónico a un usuario si su publicación fue aceptada. Primero estoy capturando el correo electrónico del usuario en una consulta si se envía un formulario, pero no estoy seguro de cómo implementar la función de correo. ¿Debería ser algo como esto ?:

if(isset($_POST ['submit'])){

//Some query to get the user email address
$results = $dbh->prepare("select $user_email from wp_users where
wp_users.ID=$user_ID");


$to=$results;
$subject="Whatever you want your subject to be";
$headers = "From: [email protected]\r\n";
$headers .= "Reply-To: [email protected] \r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

$message= "WHATEVER MESSAGE";
mail ($to , $subject , $message, $headers);
echo "Your message has been sent";


$insrt = "INSERT INTO table(ID,
        text,
        VALUES (
        :ID,
        :text)";
$stmt = $dbh->prepare($insrt);
$stmt->bindParam(':ID', $user_ID, PDO::PARAM_INT);       
$stmt->bindParam(':text', $_POST['post_text'], PDO::PARAM_STR); 
$stmt->execute(); 
} 

Respuestas a la pregunta(1)

Su respuesta a la pregunta