I have tried to send the form data to my email id. unfortunately it is not working and not getting any email from it.
I deployed into the server to test.
Experts inputs please?
here my try,
index.php
<form method="post" action="contact.php">
<div class="form-group">
<label>Name</label>
<input type="text" class="form-control" name="sender">
</div>
<div class="form-group">
<label>mail id</label>
<input type="text" class="form-control" name="senderEmail">
</div>
<div class="form-group">
<label>Mobile. No</label>
<input type="text" class="form-control" name="mobile">
</div>
<input type="submit" name="submit" class="btn btn-primary">
</form>
contact.php
<?php
if(isset($_POST['submit']) && !empty($_POST['submit'])) {
$recipient="mohan@gmail.com";
$subject="New mail";
$sender=$_POST["sender"];
$senderEmail=$_POST["senderEmail"];
$mobile=$_POST["mobile"];
$mailBody="Name: $sender\nEmail: $senderEmail\n\n$message";
mail($recipient, $subject, $mailBody, "From: $sender <$senderEmail>");
}
?>