So I have tried to add a contact form to my html website. it looks good but my php script that is supposed to send the email does not work. I try to click on my submit button and I get a HTTP ERROR 405. Here's the code.
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$mailheader = "From:".$name."<".$email.">\r\n";
$recipient = "kangaroo379@icloud.com";
mail($recipient, $subject, $message, $mailheader) or die("Error!");
echo'
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Contact form</title>
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600&family=Poppins&display=swap" rel="stylesheet">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<h1>Thank you for contacting me. I will get back to you as soon as possible!</h1>
<p class="back">Go back to the <a href="index.html">homepage</a>.</p>
</div>
</body>
</html>
';
?>
I am new to this. Does anyone know what I did wrong