I have no idea why this code isn't working. It should be right, but every time I test it the PHP file gives an "unexpected } on line 20".
PHP:
<?php
if (isset($_POST["submit"])) {
    $name = $_POST['name'];
    $email = $_POST['email'];
    $message = $_POST['InputMessage'];
    $from = 'website.com'; 
    $to = 'email@email.com'; 
    $subject = 'Subject';
    $body = "From: $name\n E-Mail: $email\n Messagge\n $message";
    if (mail ($to, $subject, $body, $from)) {
    $result='<div class="alert alert-success">Thanks! We\'ll reply as soon as possible.</div>';
    } else {
    $result='<div class="alert alert-danger">Sorry but there was error, try again later</div>';
    }
}  //this is line 20 on the original file
?>
HTML:
<form role="form" method="POST" action="contact.php">
    <div class="form-group">
       <input type="text" class="form-control" id="user_name" placeholder="Your name" name="name">
    </div>
    <div class="form-group">
       <input type="email" class="form-control" id="your_email" placeholder="Your email" name="email" required>
    </div>
    <div class="form-group">
       <textarea name="InputMessage" id="user_message" class="form-control" rows="5" required></textarea>
    </div>
    <button type="submit" class="btn medium" name="submit">Let us know</button>
</form> 
If I remove it then I get an unexpected enf of file. I don't know what to do, I'm really new with PHP.
EDIT: I checked the thread for which this has been flagged as duplicate, but it didn't solve anything. For the "unexpected }" it simply says that I probably forgot to open it, but I doubled checked the curly braces and they look ok.
 
    