Polish chars and 'To view the message, please use an HTML compatible email viewer!'
Hi,
i had the problem with polish letters in subject and body text, and patch from peter saved me. good job!. i have moved osticket from test to prod and launch support :)
BUT i have additional problems:
1) still pipe is not working correctly with polish letters and after a lot of code analysing the problem seems is in pipe.php file. Peter fixed only problems with imap/pop3 fetching. unfortenuatly i am not programmer and tried small modification in code but without effect. I think that functions in pipe.php should be rewrited as for class.mailfetch.php. maybe there is something wrong in class.mailfetch.php too, but i think that major encoding is done on pipe.php level. Anyway proper encoding should be done before database insertion. BTW i have utf8_generali_ci and it work ok with polish chars.
2) i have had one additional problems with e-mails in html. from my webform and forward settings i received e-mails in html. and my hosting seems to use X-Mailer: PHPMailer 5.1 (phpmailer.worxware.com) functionality to send e-mail. and such e-mail have Content-Type: multipart/alternative; boundary="b1_d61***********************" - 2 sections in boundary:
--b1_d61*****************************
Content-Type: text/plain; charset = "utf-8"
Content-Transfer-Encoding: 8bit
To view the message, please use an HTML compatible email viewer!
--b1_d61****************************
Content-Type: text/html; charset = "utf-8"
Content-Transfer-Encoding: 8bit
Ze strony ........ Wysyla:Wiadomość: test po ustawieniach skrzynki
--b1_d61*******************************--
and osticket took body from first one as default and i had in osticket in message body text: To view the message, please use an HTML compatible email viewer!
and the real one message in second section of boundary is missed (not parsed at all). again, i am not programmer but i 'solved' the problem just by 'making simple' function 'function getBody' in class.mailfetch.php and class.mailparse.php by commenting // properly lines: if(!($body=$this->getPart($this->struct,'text/plain'))) { and related to this line mark }
i think i forse osticket to take and work with 'text/html' part of body and put this content into database. and this is my solution for now. But i lost possiblity to receive text plain e-mails.
i think this function should be rewrited somehowe. Original condition check if 'text/plain' is not empty and take 'To view the message, please use an HTML compatible email viewer!' but it is not real content, just output from mailer. Maybe some other mailers put content to both sections and to avoid doubling data the function getBody look like in osticket 1.6ST, but in my case it work wrongly. better to add additional condition to check if there is sentance 'To view the message, please use an HTML compatible email viewer!' and then go 'text/html' part? if someone have the same problem or have the better solution :) please reply!
best regards ;)
/////////////////////////////////////
ok, after some lecture about php and home work, i have wrote my own function and seems it works! :)
function getBody($mid) {
//$problem = 'To view the message, please use an HTML compatible email viewer!';
$body ='';
if(($this->getpart($mid,'TEXT/HTML',$this->charset)) != '')
{
$body = $this->getpart($mid,'TEXT/HTML',$this->charset);
//Convert tags of interest before we striptags
$body=str_replace("", "\n", $body);
$body=str_replace(array("", "", "", ""), "\n", $body);
$body=Format:($body); //Strip tags??
}
elseif (!($body = $this->getpart($mid,'TEXT/PLAIN',$this->charset)))
{
return $body;
}
return $body;
}