php-imap icon indicating copy to clipboard operation
php-imap copied to clipboard

remove inline from options.dispositions

Open adrienbrault opened this issue 2 years ago • 1 comments

Hey,

I was not able to retrieve a text/html body without removing inline from this configuration option. With inline removed, \Webklex\PHPIMAP\Message::fetchPart is now able to extract/parse the bodies.

FYI here is the dump output for the $raw_structure of my message:

^ """
--63c14a61_e26858d_3e0\r\n
Content-Type: text/plain; charset="utf-8"\r\n
Content-Transfer-Encoding: quoted-printable\r\n
Content-Disposition: inline\r\n
\r\n
TEXT BODY
\r\n
Regards\r\n
--63c14a61_e26858d_3e0\r\n
Content-Type: text/html; charset="utf-8"\r\n
Content-Transfer-Encoding: quoted-printable\r\n
Content-Disposition: inline\r\n
\r\n
<html>HTML BODY</html>\r\n
--63c14a61_e26858d_3e0--\r\n
\r\n
"""

This may fix the following issues:

  • https://github.com/Webklex/php-imap/issues/336
  • https://github.com/Webklex/php-imap/issues/329
  • https://github.com/Webklex/php-imap/issues/275
  • https://github.com/Webklex/php-imap/issues/245
  • https://github.com/Webklex/php-imap/issues/142

adrienbrault avatar Jan 13 '23 13:01 adrienbrault

Hi @adrienbrault , many thanks for your pull requests. This is indeed an intended default feature and configurable via config for this reason. However, the documentation isn't perfect and can probably be improved. Debugging and testing certain cases isn't always trivial especially without the original mail. Please feel free to add a new test to the test folder to make sure that inline attachments get parsed accordingly. There are already a few examples available:

  • https://github.com/Webklex/php-imap/blob/master/tests/MessageTest.php
  • https://github.com/Webklex/php-imap/blob/master/tests/issues/Issue355Test.php

Best regards & thanks again,

Webklex avatar Jan 13 '23 14:01 Webklex