-1

Attempting to send mail through my site's contact form results in a blank page (no confirmation message) and no email being sent.

The HTML for the form is:

<form method="post" action="index.php">
    <div class="field half first">
        <label for="name">Name</label>
        <input type="text" name="name" id="name" />
    </div>
    <div class="field half">
        <label for="email">Email</label>
        <input type="text" name="email" id="email" />
    </div>
    <div class="field">
        <label for="message">Message</label>
        <textarea name="message" id="message" rows="4"></textarea>
    </div>
    <ul class="actions">
        <li><input type="submit" value="Send Message" class="special" /></li>
        <li><input type="reset" value="Reset" /></li>
    </ul>
</form> 

The index.php file is:

<?php
    $name = $_POST['name'];
    $email = $_POST['email'];
    $message = $_POST['message'];
    $from = 'From: SiteContactForm'; 
    $to = 'xxxx@xxxmail.net'; 
    $subject = 'Hello';

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

if (isset($_POST['submit'])) {
    if (mail ($to, $subject, $body, $from)) { 
        echo '<p>Your email has been sent.</p>';
    } else { 
        echo '<p>Something broke.</p>'; 
    }
}
?>

Are there any mistakes here that would be causing things to break? The 'to' email is my actual email, just redacted here.

Edge
  • 113
  • 5