Cutting off piped emails

Helpdesk for my helpdesk software

Moderator: mkoch227

TimPSNC
Posts: 41
Joined: Tue Jan 08, 2013 12:33 pm

Re: Cutting off piped emails

Post by TimPSNC »

Just messaged you the error

Tim
Klemen
Site Admin
Posts: 10147
Joined: Fri Feb 11, 2005 4:04 pm

Re: Cutting off piped emails

Post 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?!? :roll: :wink:

Try downloading this file again and see if you have any luck:
http://www.hesk.com/extras/hesk250_email_parser.zip
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
TimPSNC
Posts: 41
Joined: Tue Jan 08, 2013 12:33 pm

Re: Cutting off piped emails

Post 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
ascott
Posts: 9
Joined: Fri Aug 17, 2012 4:25 pm

Re: Cutting off piped emails

Post 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.
ascott
Posts: 9
Joined: Fri Aug 17, 2012 4:25 pm

Re: Cutting off piped emails

Post 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.
Klemen
Site Admin
Posts: 10147
Joined: Fri Feb 11, 2005 4:04 pm

Re: Cutting off piped emails

Post 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.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
ascott
Posts: 9
Joined: Fri Aug 17, 2012 4:25 pm

Re: Cutting off piped emails

Post 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.
Klemen
Site Admin
Posts: 10147
Joined: Fri Feb 11, 2005 4:04 pm

Re: Cutting off piped emails

Post 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
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
ascott
Posts: 9
Joined: Fri Aug 17, 2012 4:25 pm

Re: Cutting off piped emails

Post 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.
ascott
Posts: 9
Joined: Fri Aug 17, 2012 4:25 pm

Re: Cutting off piped emails

Post 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.
ascott
Posts: 9
Joined: Fri Aug 17, 2012 4:25 pm

Re: Cutting off piped emails

Post 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.
ascott
Posts: 9
Joined: Fri Aug 17, 2012 4:25 pm

Re: Cutting off piped emails

Post 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.
Klemen
Site Admin
Posts: 10147
Joined: Fri Feb 11, 2005 4:04 pm

Re: Cutting off piped emails

Post 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.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
TimPSNC
Posts: 41
Joined: Tue Jan 08, 2013 12:33 pm

Re: Cutting off piped emails

Post 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!
Klemen
Site Admin
Posts: 10147
Joined: Fri Feb 11, 2005 4:04 pm

Re: Cutting off piped emails

Post by Klemen »

Did you try the latest file posted?
http://www.hesk.com/extras/email_parser2.zip
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Post Reply