I have 2 problems. First when I get an email through my contact form the ‘from’ field is my e-mail and not client his email.
Second, my html code
is showing in the mail instead of making an enter.
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
if(isset($_POST['submit'])){
$name = stripcslashes($_POST['name']);
$phone = stripcslashes($_POST['phone']);
$email = stripcslashes($_POST['email']);
$message = stripcslashes($_POST['message']);
$headers = 'From: [email protected]' . "rn" .
'Reply-To: ' . $email . "rn" .
'X-Mailer: PHP/' . phpversion();
$subject = "Afspraak aanvraag van: " . $name;
$message = "Naam: " . $name . "<br><br>E-mail: " . $email . "<br><br>Telefoon: " . $phone . "<br><br>Bericht: ". "Bericht: " . $message;
mail('[email protected]',$subject,$message,$headers);
if(mail($subject,$message,$headers)) {
echo "<h3>Sorry, er ging iets mis.</h3>";
} else {
header('Location:https://tandartsenteam.be/bedankt');
}
}
?>