i have a website which is built in HTML and PHP . now to send mail I have made a contact form which looks like the following:
<form class="" method="post" dat-email="" action="">
  <input type="text" class="form-control" name="name" placeholder="Name" required>
  <input type="text" class="form-control" name="email" placeholder="Email" required>
  <textarea class="form-control" name="message" placeholder="Your Message" required></textarea>
  <input name="submit" class="def-btn" type="submit" value="submit">
</form>
for the form to work I have added the following PHP mail function:
<?php
if(isset($_POST['submit'])){
   $headers .= "Return-Path: The Sender <zubairnazer@gmail.com>\r\n";
   $headers .= "From: The Sender <zubairnazer@gmail.com>\r\n";
   $headers .= "Organization: Sender Organization\r\n";
   $headers .= "MIME-Version: 1.0\r\n";
   $headers .= "Content-type: text/plain; charset=iso-8859-1\r\n";
   $headers .= "X-Priority: 3\r\n";
   $headers .= "X-Mailer: PHP". phpversion() ."\r\n" ;
    $to = "zubairnaze@gmail.com";
    $from = $_POST['email'];
    $first_name = $_POST['name'];
    $last_name = $_POST['message'];
    $subject = "The Nosh Bistro Contact";
    $message = $first_name . " has sent the following message.  " . "\n\n" . $last_name. "\n\n"."Email " .$from. "\n\n" ;
  
    mail($to,$subject,$message,$headers);
   echo "<script type='text/javascript'>alert('Message Sent Successfully!')</script>";
        }
?>
before it was working fine when I used only one header, but now I added these many headers so that my mail doesn't goes to spam folder. but now the mail function is not sending mails to my gmail id and I am getting the following error:
Notice: Undefined variable: headers in /hermes/walnacweb05/walnacweb05aa/b185/as.moluguz/nosh/index.php on line 1785
can anyone please tell me what could be wrong here
