无法从html表单发送邮件

I have been working on a single page website. It have like 8 pages. Last one is contact form. I have a PHP function "send_mail.php" that posts the data to my gmail account. This code is only working if i put it in a separate html but if i call this function through my index.html, it doesnt send the email.

<section id="contact">
    <div class="container-wrapper">
        <div class="container">
            <div class="row">
                <div class="col-sm-4 col-sm-offset-8">
                    <div class="contact-form">
                        <h3>Contact Info</h3>
                        <form id="main-contact-form" name="contact-form" method="post" action="mail/send_mail.php">
                            <div class="form-group">
                                <input type="text" name="user_name" class="form-control" placeholder="Name" required>
                            </div>
                            <div class="form-group">
                                <input type="email" name="email_address" class="form-control" placeholder="Email" required>
                            </div>
                            <div class="form-group">
                                <input type="text" name="email_subject" class="form-control" placeholder="Subject" required>
                            </div>
                            <div class="form-group">
                                <textarea name="comments" class="form-control" rows="8" placeholder="Message" required></textarea>
                            </div>
                            <input type="submit" value="Submit" />
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section><!--/#bottom-->

and then my php

    <?php function isInjected($str) {
    $injections = array('(
+)',
    '(+)',
    '(\t+)',
    '(%0A+)',
    '(%0D+)',
    '(%08+)',
    '(%09+)'
    );
    $inject = join('|', $injections);
    $inject = "/$inject/i";
    if(preg_match($inject,$str)) {
        return true;
    }
    else {
        return false;
    }}$email_address = $_REQUEST['email_address'] ; 
$name = $_REQUEST['user_name'] ;
$subject = $_REQUEST['email_subject'] ;
$comments = $_REQUEST['comments'] ;

// If the user tries to access this script directly, redirect them to feedback form,
if (!isset($_REQUEST['email_address'])) {
header( "Location: index.html" );
}

// If the form fields are empty, redirect to the error page.
elseif (empty($email_address) || empty($comments)) {
header( "Location: index.html" );
}

// If email injection is detected, redirect to the error page.
elseif ( isInjected($email_address) ) {
header( "Location: index.html" );
}

// If we passed all previous tests, send the email!
else {
mail( "abcd@gmail.com", $subject,
  $comments, "From: $email_address" );
header( "Location: index.html" );
}
?>

Somehow I found the error location but couldnt narrow it down. If I remove my js references, i can send email though.