#!/usr/bin/php $contents) { $headers .= "\n".$field.": ".$contents; } } // reassemble the message $data = $headers."\n\n".$message; // write to our log file $fd = fopen($logfile,"w"); fwrite($fd, "Date: ".date("r")."\n"); fwrite($fd, "PWD: ".$_ENV['PWD']."\n"); fwrite($fd, "Msg ID: ".$messageid."\n"); fwrite($fd, "\n"); fwrite($fd, "Message:\n"); fwrite($fd, "----------\n"); fwrite($fd, $headers); fwrite($fd, "----------\n"); fwrite($fd, "Body: ".strlen($message)." bytes"); fclose($fd); // write to the real sendmail $h = popen($sendmail, "w"); fwrite($h, $data); pclose($h); ?>