I'd like to try and fix the mail function of osticket. In include/class.misc.php replace the sendmail function starting about line 57.
function sendmail($to, $subject, $message, $fromaddress,$fromname='', $xheaders = '') {
//TODO: provide an option to use SMTP server. Log all outgoing emails??
$eol="\r\n";
//do some cleanup...avoid stupid errors.
$to=preg_replace("/(\r\n|\r|\n)/s",'', trim($to));
$subject=preg_replace("/(\r\n|\r|\n)/s",'', trim($subject));
$message = preg_replace("/(\r\n|\r)/s", "\n", trim($message));
#Headers
if($fromname) {
$headers .= "From: ".$fromname." <".$fromaddress.">".$eol;
$headers .= "Reply-To: ".$fromname." <".$fromaddress.">".$eol;
$headers .= "Return-Path: ".$fromname." <".$fromaddress.">".$eol;
}
else {
$headers .= "From: ".$fromaddress.$eol;
$headers .= "Reply-To: ".$fromaddress.$eol;
$headers .= "Return-Path: ".$fromaddress.$eol;
}
$headers .= "Message-ID: <".time()."-".$fromaddress.">".$eol;
$headers .= "X-Mailer: osTicket v 1.6".$eol;
if($xheaders) { //possibly attachments...does mess with content type
$headers .= $xheaders;
}else{
$headers .= "Content-Type: text/plain; charset=utf-8".$eol;
$headers .= "Content-Transfer-Encoding: 8bit".$eol;
}
//echo "';
mail($to,$subject,$message,trim($headers));
}