Try this
Ok, sorry about the delay been on other projects.
Hopefully I have remembered all the changes I made. Remember you can break your system so please backup files first. No responsibilty taken.
I have used various hacks from these forums to preserve in coming HTML and allow HTML in responses and internal notes. These will also be required.
In include/class.email.php look for:
//do some cleanup
$eol="\n";
and replace up to :
//attachment TODO: allow multiple attachments - $attachment should be mixed parts.
With:
$to=preg_replace("/(\r\n|\r|\n)/s",'', trim($to));
$subject=stripslashes(preg_replace("/(\r\n|\r|\n)/s",'', trim($subject)));
$body = stripslashes(preg_replace("/(\r\n|\r)/s", "\n", trim($message)));
$txtbody = Format:($body);
$htmlbody = preg_replace("/(\r\n|\r)/s", "\n", trim($message));
$fromname=$this->getName();
$from =sprintf('"%s"<%s>',($fromname?$fromname:$this->getEmail()),$this->getEmail());
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject,
'Message-ID' =>'<'.Misc:(6).''.time().'-'.$this->getEmail().'>',
'X-Mailer' =>'osTicket v 1.6',
'MIME-Version' => '1.0',
'Content-Type' => 'text/html; charset="UTF-8"',
'Content-Transfer-Encoding' => 'base64'
);
#$mime = new Mail_mime();
$crlf = "\n";
$mime = new Mail_mime($crlf);
$mime->setTXTBody($textbody);
$mime->setHTMLBody($htmlbody);
Also look for:
function sendmail($to,$subject,$message,$from) {
and replace up to with:
require_once ('Mail.php'); // PEAR Mail package
require_once ('Mail/mime.php'); // PEAR Mail_Mime packge
$eol="\n";
$to=preg_replace("/(\r\n|\r|\n)/s",'', trim($to));
$subject=stripslashes(preg_replace("/(\r\n|\r|\n)/s",'', trim($subject)));
$body = stripslashes(preg_replace("/(\r\n|\r)/s", "\n", trim($message)));
$txtbody = Format:($body);
$htmlbody = preg_replace("/(\r\n|\r)/s", "\n", trim($message));
$headers = array ('From' =>$from,
'To' => $to,
'Subject' => $subject,
'Message-ID' =>'<'.Misc:(10).''.time().'@osTicket>',
'X-Mailer' =>'osTicket v 1.6',
'MIME-Version' => '1.0',
'Content-Type' => 'text/html; charset="UTF-8"',
'Content-Transfer-Encoding' => 'base64'
);
$crlf = "\n";
$mime = new Mail_mime($crlf);
$mime->setTXTBody($textbody);
$mime->setHTMLBody($htmlbody);
$options=array('head_encoding' => 'quoted-printable',
'text_encoding' => 'quoted-printable',
'html_encoding' => 'base64',
'html_charset' => 'utf-8',
'text_charset' => 'utf-8');
//encode the body
$body = $mime->get($options);
$headers = $mime->headers($headers);
$mail = mail:('mail');
return PEAR:($mail->send($to, $headers, $body))?false;
To use HTML in the various input text boxes you will need to mod your osTicket in other places. There is plenty of info in the forums.
I'll try and find the code changes I made but a bit short of time.
Cheers
Hope this helps you.