title: Modify date header in PHP email?
body: <p>Is it possible to manipulate the date header using PHP's mail function/sendmail (website server is linux so I believe it's using sendmail underneath)? </p>
  
  <p>I'm trying to test error handling of a (windows based) email checker, and need to generate an invalid date header in a message, but when I send my message using php mail, even though I am including a custom Date header, it seems to get overridden by the mail server and my custom header ignored. I'm guessing I might need an additional parameter for sendmail to tamper with that header, but I can't seem to find what that parameter would be, or whether this is even possible.</p>
  
  <p>Here is what I am sending (with the personal domain info removed)</p>
  
  <pre><code>$headers = "From: ..................\r\n";
  $headers .= "Message-ID: &lt;" . md5(uniqid(time())) . "@..................&gt;\n";
  $headers .= "MIME-Version: 1.0\n";
  //$headers .= "Date: ".date("D, d M Y H:i:s") . " UT\n"; //a valid header for comparison
  $headers .= "Date: Tuesday\n"; // intentionally bogus email header
  $headers .= "Reply-To: ..................\n";
  $headers .= "Return-Path: ..................\r\n";
  $headers .= "X-Priority: 3\r\nX-MSMail-Priority: Normal\n";
  $headers .= "X-Mailer: PHP/".phpversion()."\n";
  $headers .= "Content-type: text/plain; charset=iso-8859-1\n";
  $headers .= "\n";
  $success=mail($to, $s_subject, $s_emailmsg, $headers);
  </code></pre>