title: Sometimes big delay when using PHP mail()
body: <p>I have a website which processes orders from a Windows application. This works as follows:</p>
  
  <ol>
  <li>User clicks "Order now" in the windows app</li>
  <li>App uploads a file with POST to a PHP script</li>
  <li>The script immediately calls the PHP mail() function (order is not stored in a db)</li>
  </ol>
  
  <p>This works fine most of the time. However, sometimes a big delay occurs (several days). Customers calls why the product has not yet been delivered.</p>
  
  <p>E-mail headers of delayed mail follows:</p>
  
  <p>The delay seems to occur here:</p>
  
  <pre><code>Received: (from @localhost)
  by ---- (8.13.8/8.13.8/Submit) id o4J9lA7M031307;
  Wed, 19 May 2010 11:47:10 +0200
  </code></pre>
  
  <p>I've reported this issue various times to the web hosting service that hosts my website. They say the delay does not occur in their network (impossible). </p>
  
  <p>But they do confirm that the e-mail is first seen in their mail server on May 26, which is 7 days after the mail has been composed. The order is marked with the timestamp of the user's local PC, which also matches May 19 (so it's not a PC clock problem)</p>
  
  <p>It's also interesting to see that all delayed mails (orders were placed on different days) come in at once. So I suddenly receive 14 e-mail in my mailbox from various days.</p>
  
  <p>Any idea were this delay may be introduced? Could there be a bug in my PHP code that causes this? (I cannot believe I can introduce a loop of 7 days in my PHP code)</p>