title: Is there a way reduce the Email Delay of PHP Mail()
body: <p>I am using a fastcomet website, and I am trying to create a feedback messaging system.</p>
  
  <p>I have created the following function, for organizing a template for sending emails along with the headers accompanied to it.</p>
  
  <p><strong>send_email.php</strong></p>
  
  <pre><code>&lt;?php
  function send_email($to,$from,$title,$sending_message){
  
  $message="&lt;html&gt;&lt;body&gt;";
  $message.=$sending_message;
  $message.="&lt;/body&gt;&lt;/html&gt;";
  
  $headers = "From: ". $from . "\r\n";
  $headers .= "Reply-To: ". $from ."\r\n";
  $headers .= "Return-Path:".  $from . " \r\n";
  $headers .= "CC:\r\n";
  $headers .= "BCC:\r\n";
  
  $headers .= "MIME-Version: 1.0\r\n";
  $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
  
  return mail($to, $title,$message,$headers);
  
  }
  
  ?&gt;
  </code></pre>
  
  <p>With other pages, I use the following code <code>include 'send_email.php'</code>, and use the function <code>send_email($to, $title,$message,$headers)</code>, and it works. The only problem is that the receival of the email either takes too long, or arbitrary in nature.</p>
  
  <p>Sometimes, I test the feedback system by sending 3 emails. For example: Email1, Email2, Email3 are sent in the following order. Sometimes, I'll receive Email3 first than Email1 or Email2 first than Email3.</p>
  
  <p>In terms of time, sometimes I'll receive the email in a few minutes, but some in a few hours which makes testing difficult because I am not able to know the results of the code until a few hours, which leaves me to wonder whether my code worked or not.</p>
  
  <p>Note: </p>
  
  <ul>
  <li><p>By using the following code <code>echo "&lt;p&gt;". error_get_last()['message'] . "&lt;/p&gt;";</code> I am able to figure out that the function did run successfully.</p>
  
  <ul>
  <li>I tried testing using both AJAX request and Form submission, and I found that generally Form submission takes less time for it to be received. (although I like the concept of AJAX request, where I don't have to change page)</li>
  </ul></li>
  </ul>
  
  <p><strong>My question is, is there a way to reduce the time it takes to receive the email? or is there a better way to approach this problem?</strong></p>