测试联系电子邮件Wordpress模板不发送

I've been trying to figure this out for hours, but can't figure out what I'm doing wrong.

I've created a Wordpress contact page, but when I try to send the test email to myself, nothing ever comes through. I'm not getting any errors or anything-- what am I missing here? Thanks for looking, and let me know if you need any extra information.

HTML/PHP:

<!--------------- YOUR INFO -------------------->
<div class="col-xs-10 col-xs-offset-1 col-lg-6 col-lg-offset-3" id="contactWrapper">
    <h3 id="contactSectionHeader" class="p-t-2"><i class="fa fa-plus-square-o"></i> YOUR INFORMATION</h3>

    <form class="form-horizontal" role="form" method="post" action="contactform.php">
    <div class="form-group">
        <label for="name" class="col-sm-2 control-label">Name</label>
        <div class="col-sm-10">
            <input type="text" class="form-control" id="name" name="name" placeholder="First & Last Name" value="">
            <?php echo "<p class='text-danger'>$errName</p>";?>
        </div>
    </div>
    <div class="form-group">
        <label for="email" class="col-sm-2 control-label">Email</label>
        <div class="col-sm-10">
            <input type="email" class="form-control" id="email" name="email" placeholder="example@domain.com" value="">
            <?php echo "<p class='text-danger'>$errEmail</p>";?>
        </div>
    </div>
    <div class="form-group">
        <label for="message" class="col-sm-2 control-label">Message</label>
        <div class="col-sm-10">
            <textarea class="form-control" rows="4" name="message"></textarea>
            <?php echo "<p class='text-danger'>$errMessage</p>";?>
        </div>
    </div>
    <div class="form-group">
        <label for="human" class="col-sm-2 control-label">2 + 3 = ?</label>
        <div class="col-sm-10">
            <input type="text" class="form-control" id="human" name="human" placeholder="Your Answer">
                        <?php echo "<p class='text-danger'>$errHuman</p>";?>
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-10 col-sm-offset-2">
            <input id="submit" name="submit" type="submit" value="Send" class="btn btn-primary">
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-10 col-sm-offset-2">
            <?php echo $result; ?>  
        </div>
    </div>
</form>

</div>

PHP/SEND PAGE:

<?php
    if (isset($_POST["submit"])) {
        $name = $_POST['name'];
        $email = $_POST['email'];
        $message = $_POST['message'];
        $human = intval($_POST['human']);
        $from = 'Demo Contact Form'; 
        $to = 'brandon@brandonstiles.com';
        $subject = 'Message from Contact Demo ';

        $body = "From: $name
 E-Mail: $email
 Message:
 $message";

        // Check if name has been entered
        if (!$_POST['name']) {
            $errName = 'Please enter your name';
        }

        // Check if email has been entered and is valid
        if (!$_POST['email'] || !filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
            $errEmail = 'Please enter a valid email address';
        }

        //Check if message has been entered
        if (!$_POST['message']) {
            $errMessage = 'Please enter your message';
        }
        //Check if simple anti-bot test is correct
        if ($human !== 5) {
            $errHuman = 'Your anti-spam is incorrect';
        }

// If there are no errors, send the email
if (!$errName && !$errEmail && !$errMessage && !$errHuman) {
    if (wp_mail ($to, $subject, $body, $from)) {
        $result='<div class="alert alert-success">Thank You! I will be in touch</div>';
    } else {
        $result='<div class="alert alert-danger">Sorry there was an error sending your message. Please try again later</div>';
    }
}
    }
?>

First you should allow errors in php:

error_reporting(E_ALL);

on the top of the page.

And put the following into your wp-config.php:

define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
@ini_set('display_errors', 0);

Second you should check if your server has sendmail enabled.

You can make this with a short search in the php information.

Make a new .php file with the following content:

<?php
phpinfo();

then search after "sendmail".

Third you should check if your webhoster has special requirements for sending mails with php. For example, a big german webhoster does only allow php mails with additional_parameters.

And last you should check if your code has all requirements from wordpress and check each line of the code with a debugger. Or make a new .php file with a working mail function on your server to test if the problem is your server or your script.

If you have access to the server logs, you should check them too.