PHP电子邮件表单不能发送电子邮件- Can't Figure Out


PHP Email Form Won't Send Email - Can't Figure This Out

我正在建立一个网站,我有问题的php形式。我已经看过了,找不到任何我认为不对的地方。然而,我也不是很精通PHP和从未创建过这样的表单之前。如果你能帮忙,非常感谢。

代码如下:

PHP:

<?php
$company = $_POST['company']; 
$email = $_POST['email'];
$name = $_POST['name'];
$phone = $_POST['phone'];
$numberofvehicles = $_POST['numofvehicles'];
$date= $_POST['date'];
$time = $_POST['time'];
$address = $_POST['address'];
$to = 'email@email.com';
$subject = "GPS Form Request: $company'n";
$body = "From: $name'n E-Mail: $email'n Company:'n $company Phone: $phone'n Date: $date'n Time: $time'n Address: $address'n Number of Vehicles: $numberofvehicles'n";
$headers = "From: $email" . "'r'n" .
"Reply-To: $email" . "'r'n" .
"X-Mailer: PHP/" . phpversion();
if(isset($_POST['submit']){               
mail ($to, $subject, $body, $headers);  //mail sends it to the SMTP server side which sends the email
    echo "<p>Your message has been sent!</p>";
} 
else { 
    echo "<p>Something went wrong, go back and try again!</p>"; 
}
?>
HTML:

                   <form id="contact-form" method="post" action="/php/email.php" role="form">
<fieldset>
    <div class="messages"></div>
    <div class="controls">
        <div class="row">
            <div class="col-md-6">
                <div class="form-group">
                    <label for="company_name">Your Company's Name</label>
                    <input id="company_name" type="text" name="company" class="form-control" placeholder="Please enter your company's name *" required="required" data-error="Firstname is required.">
                    <div class="help-block with-errors"></div>
                </div>
            </div>
            <div class="col-md-6">
                <div class="form-group">
                    <label for="your_name">Your Name</label>
                    <input id="your_name" type="text" name="name" class="form-control" placeholder="Please enter your first and last name *" required="required" data-error="Lastname is required.">
                    <div class="help-block with-errors"></div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-6">
                <div class="form-group">
                    <label for="form_email">Preferred Email</label>
                    <input id="form_email" type="email" name="email" class="form-control" placeholder="Please enter your preferred email *" required="required" data-error="Valid email is required.">
                    <div class="help-block with-errors"></div>
                </div>
            </div>
            <div class="col-md-6">
                <div class="form-group">
                    <label for="form_phone">Preferred Phone</label>
                    <input id="form_phone" type="tel" name="phone" class="form-control" placeholder="Please enter your preferred phone number">
                    <div class="help-block with-errors"></div>
                </div>
            </div>
        </div>
    <div class="row">
        <div class="col-md-6">
                <div class="form-group">
                    <label for="vehicles_number">Number of Vehicles</label>
                    <input id="vehicles_number" type="text" name="numofvehicles" class="form-control" placeholder="How many vehicles for installation?">
                    <div class="help-block with-errors"></div>
                </div>
            </div>
        <div class="col-md-6">
                <div class="form-group">
                    <label for="install_address">Installation Address</label>
                    <input id="input_address" type="text" name="address" class="form-control" placeholder="What is the installation address?">
                    <div class="help-block with-errors"></div>
                </div>
            </div>
        </div>
     <div class="row">
        <div class="col-md-6">
                <div class="form-group">
                    <label for="install_date">Choose a Date for Installation</label>
                    <input id="calendar"  name="date" type="text" class="form-control" placeholder="Please choose a date for installation" >
                    <div class="help-block with-errors"></div>
                </div>
            </div>
        <div class="col-md-6">
                <div class="form-group">
                    <label for="install_time">Choose a Time for Installation</label>
                    <input id="install_time" type="time" name="phone" class="form-control" placeholder="Please choose a time for installation">
                    <div class="help-block with-errors"></div>
                </div>
            </div>
        </div>
        <div class="row">
            </fieldset>
            <fieldset>
            <div class="col-md-12">
                <input type="submit" id="submit" name="submit" class="btn btn-success btn-send" value="Send message">
            </div>
        </div>
        </div>
    </div>
</fieldset>
</form>
</container>
                </div>
            </div>
        </div>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="js/bootstrap-datepicker.js"></script>
<script>
    $('#calendar').datepicker({
        inline: true,
        firstDay: 1,
        showOtherMonths: true,
        dayNamesMin: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
    });
</script>
    </body>
</div>

php if语句缺少右括号。

if(isset($_POST['submit']))

在语句的最后^