php sending email
<p>mailer.php</p>

<pre><code>&lt;?php
if(isset($_POST['submit'])) {

$to = "abc@gmail.com";
$subject = "Contact via website";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$message = $_POST['message'];

$body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message";

echo "1";
echo "Data has been submitted to $to!";
mail($to, $subject, $body);

} else {
echo "0";
}
?&gt;
</code></pre>

<p>jquery code</p>

<pre><code>$('.submit').click(function(){
            $('span.msg').css({'visibility': 'visible'}).text('Sending...');
            $.post("mailer.php", $(".contactPage").serialize(),
                function(data){
                    $('span.msg').text((data == "1") ? 'Your Message has been received. Thank you' : "Could not send your message at this time").show();
                });

            return false;    
        });
</code></pre>

<p>I am always getting</p>

<pre><code>Could not send your message at this time
</code></pre>

<p>I have almost no knowledge in php, whats i am doing wrong?</p>
