I am trying to use a simple php form to submit emails. As extra information I am hosting on netlify.
The problem is, nothing is echoing in the browser/console and no email is being received and i dont have an error message anywhere, all I get is a message from netlify saying this - after i click 'submit' : 

The code:
            <form name="captureClientContactPage" data-netlify="true"id="contact-form" class="contact__form mt-5" method="post" action="mail.php">
         <!-- form message -->
            <div class="row">
                <div class="col-12">
                    <div class="alert alert-success contact__msg" style="display: none" role="alert">
                        Your message was sent successfully.
                    </div>
                </div>
            </div>
            <!-- end message -->
            <div class="form-row">
                <div class="col-lg-12">
                     <div class="form-group-2 mb-4">
                        <textarea name="message" class="form-control" rows="6" placeholder="Your Message"></textarea>
                    </div>
                    <div class="text-center">
                        <button class="btn btn-main" name="submit" type="submit">Send Message</button>
                    </div>
                </div>
            </div>
        </form>
Then this is the php file mail.php:
<?php
    if ($_SERVER["REQUEST_METHOD"] == "POST") {
        # FIX: Replace this email with recipient email
        $mail_to = "myemail@myemail.com";
        # Sender Data
        // $subject = trim($_POST["subject"]);
        $name = str_replace(array("\r","\n"),array(" "," ") , strip_tags(trim($_POST["name"])));
        $email = filter_var(trim($_POST["email"]), FILTER_SANITIZE_EMAIL);
        $message = trim($_POST["message"]);
        if ( empty($name) OR !filter_var($email, FILTER_VALIDATE_EMAIL) OR empty($subject) OR empty($message)) {
            # Set a 400 (bad request) response code and exit.
            http_response_code(400);
            echo "Please complete the form and try again.";
            exit;
        }
        # Mail Content
        $content = "Name: $name\n";
        $content .= "Email: $email\n\n";
        $content .= "Message:\n$message\n";
        # email headers.
        $headers = "From: $name <$email>";
        # Send the email.
        $success = mail($mail_to,$content, $headers);
        if ($success) {
            # Set a 200 (okay) response code.
            http_response_code(200);
            echo "Thank You! Your message has been sent.";
        } else {
            # Set a 500 (internal server error) response code.
            http_response_code(500);
            echo "Oops! Something went wrong, we couldn't send your message.";
        }
    } else {
        # Not a POST request, set a 403 (forbidden) response code.
        http_response_code(403);
        echo "There was a problem with your submission, please try again.";
    }
?>
any help would be greatly appreciated. thanks very much.
If you need any more information please do ask,
Dale.
 
    