\r\n"; $headers .= "Reply-To: $email\r\n"; $headers .= "Content-Type: text/plain; charset=UTF-8\r\n"; // Send email if (mail($to, $subject, $body, $headers)) { // Redirect to index.php after successful email header('Location: index.php'); exit; // Make sure no further code is executed after the redirect } else { // If the email fails, you might want to display an error or redirect elsewhere echo "There was an error sending the email."; } } ?>