Is it possible to manipulate the date header using the PHP / sendmail mail function (the website server is linux, so I believe it uses sendmail below)?
I am trying to check for error handling (Windows-based checks) and I need to create an invalid date header in the message, but when I send my message using php mail, even if I include the custom date header, it seems to be overridden by the mail server, and mine custom header is ignored. I assume that I might need an additional parameter for sendmail to fake this header, but I canβt find what this parameter will be, or it is even possible.
Here is what I send (with deleted personal domain information)
$headers = "From: ..................\r\n"; $headers .= "Message-ID: <" . md5(uniqid(time())) . "@..................>\n"; $headers .= "MIME-Version: 1.0\n"; //$headers .= "Date: ".date("D, d MYH: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);
source share