Having an Issue Using Mailer. Php

Having an Issue Using Mailer. Php

I'm currently using a mailer.php file for a minimal contact form

However I have noticed recently then when submitting the form, I am getting the following error;

HTTP Error 405.0 - Method Not Allowed The page you are looking for cannot be displayed because an invalid method (HTTP verb) is being used.

My mailer.php file is the following

<?php
$email_to = "[email protected]";
$name = $_POST["name"];
$email_from = $_POST["[email protected]"];
$message = $_POST["message"];
$email_subject = "Feedback from website";
$headers = "From: " . $email_from . "\n";
$headers .= "Reply-To: " . $email_from . "\n";
$message = "Name: ". $name . "\r\nMessage: " . $message;

ini_set("sendmail_from", $email_from);
$sent = mail($email_to, $email_subject, $message, $headers, "-f" .$email_from);
if ($sent)
{
header("Location: ");
} else {
echo "There has been an error sending your message. Please try later.";
}
?>

The form using this file has the following form tag

<form method="post" action="mailer.php">

PHP is not my strong point so I'm not sure why this maybe happening. The form itself does not have a captcha field. Could spam be the root of the issue?

I'd appreciate anyone who can shed this light on this for me

3
Alexander Ross
Author

Alexander Ross

Alexander Ross has covered the video game industry for a decade, writing deep dives on game design, esports tournaments, VR developments, and gaming culture.