title: creating a php application that can email customers based on database variables pass by the $post command in a form
body: <p>I am writting a simple backend only i can access but it will have access to other mysql databases of other software, got that working great and the dashboard looks good but the one thing i am getting stuck on is I am trying to display a html table with data from the database and then in one column there will be a button that when clicked launches a window to email the client based on client information retrieved from the mysql table.</p>
  
  <p>Long winded sorry, I have got all the code working bar one thing the form i use posts to a php file called email.php for example and should then send the information via email to the email address provided by the database. i have got myself bogged down here and can't quite seem to get this to work i have tried all sorts of methods but the email does not get sent. below is a snippet of the email.php code:</p>
  
  <pre><code>&lt;?php
  if(isset($_POST["submit"])){
      // Checking For Blank Fields..
      if($_POST["email"]==""||$_POST["subject"]==""||$_POST["message"]==""){
          echo "Fill All Fields..";
      }else{
          // Check if the "Sender's Email" input field is filled out
          $email="support@ohostme.com";
          // Sanitize E-mail Address
          $email =filter_var($email, FILTER_SANITIZE_EMAIL);
          // Validate E-mail Address
          $email= filter_var($email, FILTER_VALIDATE_EMAIL);
          if (!$email){
              echo "Invalid Sender's Email";
          }
          else{
              $subject = $_POST['email'];
              $message = $_POST['subject'];
              // Message lines should not exceed 70 characters (PHP rule), so wrap it
              $message = wordwrap($message, 70);
              // Send Mail By PHP Mail Function
              mail($email, $subject, $message, $headers);
              echo "Your mail has been sent successfuly ! Thank you for your feedback";
          }
      }
  }
  ?&gt;
  </code></pre>
  
  <p>So form would be:</p>
  
  <p>email: the email address of client to be sent email(we get this from database using php echo)</p>
  
  <p>subject: the subject passed by the (value="") option always the same.</p>
  
  <p>message: this is the generic message already created and in the textarea an email pre written (this is sent via $post using the name attr of message to the php script).</p>
  
  <p>Now i have all the code working but the sending function as no email is ever received. </p>