title: Send mail by php mail() function
body: <p>I have problem with sending mail message by php <em>mail()</em> function. I'm not sure if it's problem with code coz I have read that some hosting servers are not allowing to sends mail but I'm trying to send this mail also when website is on localhost and it still doesn't work - after click "Send" I see the information: "Your mail is sent", but when I'm checking on my postbox there is no mails (also in spam). </p>
  
  <p>For me code looks good but maybe I'm missing something. The second option which I'm considering is that also my localhost is not allowing to send mails. </p>
  
  <pre><code>&lt;form id="contact" action="mail.php" method="POST"&gt;
      &lt;div class="field"&gt;
          &lt;label class="fixed_width" for="name"&gt;Name:&lt;/label&gt;&lt;input id="name" name="name" value="Name"/&gt;
      &lt;/div&gt;
      &lt;div class="field"&gt;
          &lt;label class="fixed_width" for="surname"&gt;Surname:&lt;/label&gt;&lt;input id="surname" name="surname" value="Surname"/&gt;
      &lt;/div&gt;
      &lt;div class="field"&gt;
          &lt;label class="fixed_width" for="mail"&gt;E-mail:&lt;/label&gt;&lt;input id="mail" name="mail" value="E-mail"/&gt;
      &lt;/div&gt;
      &lt;div class="field" id="message"&gt;
          &lt;label class="fixed_width" id="message_width" for="mail"&gt;Message:&lt;/label&gt;
          &lt;textarea id="message" name="message" /&gt;Type your message...&lt;/textarea&gt;
      &lt;/div&gt;
      &lt;div&gt;
          &lt;input class="width" type="submit" value="Send" /&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  
  &lt;?php
  
      srand((double)microtime()*1000000);
      $marker = md5(uniqid(rand()));
  
      $receiver  = "address@gmail.com";
      $title = "Mail";
      $sender  = $_POST['name'];
      $sender .= $_POST['surname'];
      $sender_mail = $_POST['mail'];
  
      $message = $_POST['message'];
  
      $headers  = "From: $sender &lt;$sender_mail&gt;\n";
      $headers .= "MIME-Version: 1.0\n";
      $headers .= "Content-Type: multipart/mixed;\n";
      $headers .= "\tboundary=\"___$marker==\"";
  
      $content ="--___$marker==\n";
      $content .="Content-Type: text/plain; charset=\"iso-8859-2\"\n";
      $content .="Content-Transfer-Encoding: 8bit\n";
      $content .="\n$message\n";
  
      if (mail($receiver,$title,$content,$headers))
      {
          print "Your message is sent.";
      } else {
          print "Your message is not sent.
          &lt;br&gt;Please go &lt;a href=\"javascript:history.back();\"&gt;back&lt;/a&gt; and send again.";
      }
  ?&gt;
  </code></pre>
  
  <p>Pictures with my php conf: </p>
  
  <p><img src="https://i.stack.imgur.com/1pYxt.png" alt="PHP config">
  <img src="https://i.stack.imgur.com/PfvnA.png" alt="PHP config">
  <img src="https://i.stack.imgur.com/Dyedz.png" alt="PHP config"></p>