I put this code on top of the same page:
<?php
if(isset($_POST['submit'])){
$to = "rightysahu@gmail.com";
$from = $_POST['email'];
$first_name = $_POST['first_name'];
$message = $first_name . " " . " wrote the following:" . "\n\n" . $_POST['message'];
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
echo "Mail Sent. Thank you " . $first_name . ", we will contact you shortly.";
}
?>
And here is html (same page) coding:
<form action="" method="post" >
<input type="text" name="first_name" placeholder="Name" />
<input type="text" name="email" placeholder="Email" />
<textarea name="message" placeholder="Message"></textarea>
<input type="submit" name="submit" value="Submit" />
</form>
Form submitted successfully but did not get e-mails(inbox). PLease find out errors.(running on my site not on local server.)