SSilence / php-imap-client

a easy solution for simple IMAP email access in php
MIT License
268 stars 136 forks source link

quotable-printable error #189

Closed jorygun closed 7 years ago

jorygun commented 7 years ago

Feature request or bug

Bug, but not sure if code bug or user bug

If a bug, what did you expect to happen?

Perfection ?

If a bug, what happened?

If a bug, list steps to reproduce bugs.

If a bug, did you do these steps?

[x] Download and use the lastest stable version [x] See if the issue has already been reported [x] Debug

If a feature request, what do you want to be added or changed?

If a feature request, is this feature already in a pull request?

If a feature request, do you know anyone who can help?

Side notes(Read then del this chunk)

I am reading a message that contains a url with = signs in it, and I'm getting a quotable printable error from it. I tried other text lines, and anything in the message that contains = followed by \S causes the same problem. Messages coming from Apple Mail.app set to plain text.

http://amdflames.org/scripts/news_article_c.php?id=862&s=1PQrV13145

What I get: http://amdflames.org/scripts/news_article_c.php?id�2&s=1QrV13145

And Try setting c=abc+def comes out Try setting c�c+def

Also, from PHP: Notice: Unknown: Invalid quoted-printable sequence: =PQrV13145

Not sure how to resolve this. The message array shows encoding=4, but not sure if that's the problem.

[text] => SSilence\ImapClient\SubtypeBody Object ( [charset] => us-ascii [_structure:SSilence\ImapClient\Section:private] => stdClass Object ( [type] => 0 [encoding] => 4 [ifsubtype] => 1 [subtype] => PLAIN [ifdescription] => 0 [ifid] => 0 [lines] => 45 [bytes] => 1362 [ifdisposition] => 0 [ifdparameters] => 0 [ifparameters] => 1 [parameters] => Array ( [0] => stdClass Object ( [attribute] => charset [value] => us-ascii )

                            )

                    )
jorygun commented 7 years ago

The raw message does in fact show encoding is quoted printable. --Apple-Mail=_6A494713-DB75-4D0E-9ED7-9A45342F18F6 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii

mattparksjr commented 7 years ago

It seems another web service has the same issue: https://github.com/mailwatch/MailWatch/issues/702

mattparksjr commented 7 years ago

Also may have to do with apple mail... They arent to nice :)

jorygun commented 7 years ago

Experimented some more... attached some code, output and email source code, if it helps. qp problem.txt

gr0g commented 7 years ago

any ETA on the fix for this? thanks!

halojoy commented 6 years ago

I get the same error: Notice: Unknown: Invalid quoted-printable sequence: =mail&utm_source=link&utm_campaign=sig-email&utm_content=webmail> Virus-free. w (errflg=3) in Unknown on line 0

The script I use in PHP 7.2.3 is:

$emails = $imap->getMessagesByCriteria('SINCE "2018-01-01"');
foreach($emails as $email) {
    echo $email->header->subject;
    echo '<br>';
}