Page 2 of 3
Re: Cutting off piped emails
Posted: Fri Jul 19, 2013 11:34 am
by TimPSNC
Just messaged you the error
Tim
Re: Cutting off piped emails
Posted: Fri Jul 19, 2013 11:50 am
by Klemen
Found it - the quoted_printable_encode function is available only since PHP 5.3.0 (unlike the quoted_printable_decode which is since PHP 4).
What version of PHP are you guys running?!?
Try downloading this file again and see if you have any luck:
http://www.hesk.com/extras/hesk250_email_parser.zip
Re: Cutting off piped emails
Posted: Fri Jul 19, 2013 12:02 pm
by TimPSNC
I'm running 5.3
I've tried the new file and it seems to be working- I'll let you know
Tim
Re: Cutting off piped emails
Posted: Fri Jul 19, 2013 12:10 pm
by ascott
I won't bother with the full debug message. Here's where the problem lies:
Fatal error: Call to undefined function quoted_printable_encode() in /home5/visualf4/public_html/hesk_WRJ7xfau/inc/mail/email_parser.php on line 841
It appears that quoted_printable_encode() is a PHP 5.3 function. We're using 5.2.17.
Re: Cutting off piped emails
Posted: Fri Jul 19, 2013 12:15 pm
by ascott
I tried imap_8()/imap_qprint() instead of the quoted_printable_ functions and the fetching now works. The email text is still mangled, though.
Re: Cutting off piped emails
Posted: Fri Jul 19, 2013 12:17 pm
by Klemen
ascott - yes, we found the issue, see few posts above.
Try downloading this again:
http://www.hesk.com/extras/hesk250_email_parser.zip
If you still have problems after using this updated file please send a sample email that gets truncated to
pop3test AT hesk DOT com.
Re: Cutting off piped emails
Posted: Fri Jul 19, 2013 12:33 pm
by ascott
ascott - yes, we found the issue, see few posts above.
Sorry about that, our messages crossed.
I tried the new file, but the messages are still truncated. The problem character appears to be ’
I'll send off a sample email.
Re: Cutting off piped emails
Posted: Fri Jul 19, 2013 1:29 pm
by Klemen
Could you confirm you don't have mb_string extension enabled on the server?
Does this file fix the issue for you?
http://www.hesk.com/extras/email_parser2.zip
Re: Cutting off piped emails
Posted: Fri Jul 19, 2013 2:03 pm
by ascott
Yes, the mb_string extension is enabled. I tested mb_decode_numericentity() on another page and it worked okay with ’.
As you might guess, the new file didn't help.
Re: Cutting off piped emails
Posted: Fri Jul 19, 2013 3:06 pm
by ascott
I added some test code to dump the contents of $file out to files at various points in hesk_convert_to_utf8_and_clean_html_entities(). From what I can see, the email message is being returned correctly from that function. The problem character is being returned as three byte UTF-8.
Re: Cutting off piped emails
Posted: Fri Jul 19, 2013 3:54 pm
by ascott
It looks like the culprit is strip_tags(). The message is okay before it's called at line 769 in email_parser.php and then truncated after the call.
Re: Cutting off piped emails
Posted: Fri Jul 19, 2013 8:36 pm
by ascott
I think I found the problem. My problem email message contains several pairs of << and >>. In the original HTML, those are encoded as < and >. At around line 980 of email_parser.php the entity references get switched back to the original < and >. Those characters break the HTML tag structure, so strip_tags() gets confused and removes text that it shouldn't.
Re: Cutting off piped emails
Posted: Sat Jul 20, 2013 6:54 pm
by Klemen
Thanks for reporting this.
I am currently out of the country, but will see if I can reproduce the issue and fix it when I return.
Re: Cutting off piped emails
Posted: Wed Jul 24, 2013 2:49 pm
by TimPSNC
Is there any ETA on a fix for this? Emails are being cut off a lot, and its come at the worst time for my organisation!
Re: Cutting off piped emails
Posted: Wed Jul 24, 2013 8:55 pm
by Klemen