php sending email

Haubemuddek

New Member
mailer.php\[code\]<?phpif(isset($_POST['submit'])) {$to = "[email protected]";$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";}?>\[/code\]jquery code\[code\]$('.submit').click(function(){ $('span.msg').css({'visibility': 'visible'}).text('Sending...'); $.post("mailer.php", $(".contactPage").serialize(), function(data){ $('span.msg').text((data =http://stackoverflow.com/questions/3596280/="1") ? 'Your Message has been received. Thank you' : "Could not send your message at this time").show(); }); return false; });\[/code\]I am always getting\[code\]Could not send your message at this time\[/code\]I have almost no knowledge in php, whats i am doing wrong?
 
Back
Top