From ca98a9e3574317b04aa705fb5fcd5b6020b5767c Mon Sep 17 00:00:00 2001 From: Webklex Date: Wed, 10 Nov 2021 20:46:35 +0100 Subject: [PATCH] php-imap updated to v3 --- CHANGELOG.md | 73 +++++++++++++++++++++++++++++++++++++++++++++ composer.json | 2 +- src/config/imap.php | 28 ++++++++++++----- 3 files changed, 95 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index be6e28c..f8e15d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,79 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip - NaN +## [3.0.0-alpha] - 2021-11-10 +### Fixed +- Debug line position fixed +- Handle incomplete address to string conversion +- Configured message key gets overwritten by the first fetched message +- Attachment::save() return error 'A facade root has not been set' +- Unused dependencies removed +- Fix PHP 8 error that changes null back in to an empty string. (thanks @mennovanhout) +- Fix regex to be case insensitive (thanks @mennovanhout) +- Attachment detection updated +- Timeout handling improved +- Additional utf-8 checks added to prevent decoding of unencoded values +- Boundary detection simplified +- Prevent potential body overwriting +- CSV files are no longer regarded as plain body +- Boundary detection overhauled to support "related" and "alternative" multipart messages +- Attachment saving filename fixed +- Unnecessary parameter removed from `Client::getTimeout()` +- Missing encryption variable added - could have caused problems with unencrypted communications +- Prefer attachment filename attribute over name attribute +- Missing connection settings added to `Folder:idle()` auto mode +- Message move / copy expect a folder path +- `Client::getFolder()` updated to circumvent special edge cases +- Missing connection status checks added to various methods +- Unused default attribute `message_no` removed from `Message::class` +- Fix setting default mask from config (thanks @shacky) +- Chunked fetch fails in case of less available mails than page size +- Protocol::createStream() exception information fixed +- Legacy methods (headers, content, flags) fixed +- Legacy connection cycle fixed (thanks @zssarkany) +- Several POP3 fixes (thanks @Korko) +- Fixes handling of long header lines which are seperated by `\r\n\t` (thanks @Oliver-Holz) +- Fixes to line parsing with multiple addresses (thanks @Oliver-Holz) +- Fixed problem with skipping last line of the response. (thanks @szymekjanaczek) +- Extend date parsing error message +- Fixed 'Where' method replaces the content with uppercase +- Don't surround numeric search values with quotes +- Context added to `InvalidWhereQueryCriteriaException` +- Redundant `stream_set_timeout()` removed + +### Added +- Auto reconnect option added to `Folder::idle()` +- Dynamic Attribute access support added (e.g `$message->from[0]`) +- Message not found exception added +- Chunked fetching support added `Query::chunked()`. Just in case you can't fetch all messages at once +- "Soft fail" support added +- Count method added to `Attribute:class` +- Convert an Attribute instance into a Carbon date object +- Disable rfc822 header parsing via config option +- Added imap 4 handling. (thanks @szymekjanaczek) +- Added laravel's conditionable methods. (thanks @szymekjanaczek) +- Expose message folder path (thanks @Magiczne) +- Adds mailparse_rfc822_parse_addresses integration (thanks @Oliver-Holz) +- Added moveManyMessages method (thanks @Magiczne) +- Added copyManyMessages method (thanks @Magiczne) +- Added `UID` as available search criteria (thanks @szymekjanaczek) +- Make boundary regex configurable (thanks @EthraZa) +- IMAP ID support added +- Enable debug mode via config +- Custom UID alternative support added +- Fetch additional extensions using `Folder::query(["FEATURE_NAME"])` +- Optionally move a message during "deletion" instead of just "flagging" it (thanks @EthraZa) +- `WhereQuery::where()` accepts now a wide range of criteria / values. + +### Breaking changes +- A new exception can occur if a message can't be fetched (`\Webklex\PHPIMAP\Exceptions\MessageNotFoundException::class`) +- `Message::move()` and `Message::copy()` no longer accept folder names as folder path +- A `Message::class` instance might no longer have a `message_no` attribute +- All protocol methods which had a `boolean` `$uid` option no longer support a boolean. Use `IMAP::ST_UID` or `IMAP::NIL` instead. If you want to use an alternative to `UID` just use the string instead. +- Default config option `options.sequence` changed from `IMAP::ST_MSGN` to `IMAP::ST_UID`. +- `Folder::query()` no longer accepts a charset string. It has been replaced by an extension array, which provides the ability to automatically fetch additional features. + + ## [2.4.0] - 2021-01-09 ### Fixed - Attachment::save() return error 'A facade root has not been set' diff --git a/composer.json b/composer.json index 3fa4f9b..7285bb4 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,7 @@ "ext-mbstring": "*", "ext-iconv": "*", "ext-fileinfo": "*", - "webklex/php-imap": "^2.4", + "webklex/php-imap": "^3.0", "laravel/framework": ">=5.0.0" }, "autoload": { diff --git a/src/config/imap.php b/src/config/imap.php index 1834b76..6dc2b03 100644 --- a/src/config/imap.php +++ b/src/config/imap.php @@ -60,7 +60,9 @@ 'request_fulluri' => false, 'username' => null, 'password' => null, - ] + ], + "timeout" => 30, + "extensions" => [] ], /* @@ -96,7 +98,7 @@ | This option is only used when calling $oClient-> | You can use any supported char such as ".", "/", (...) | -Fetch option: - | IMAP::FT_UID - Message marked as read by fetching the message body + | IMAP::FT_UID - Message marked as read by fetching the body message | IMAP::FT_PEEK - Fetch the message without setting the "seen" flag | -Fetch sequence id: | IMAP::ST_UID - Fetch message components using the message uid @@ -105,8 +107,16 @@ | Default TRUE | -Flag download option | Default TRUE + | -Soft fail + | Default FALSE - Set to TRUE if you want to ignore certain exception while fetching bulk messages + | -RFC822 + | Default TRUE - Set to FALSE to prevent the usage of \imap_rfc822_parse_headers(). + | See https://github.com/Webklex/php-imap/issues/115 for more information. + | -Debug enable to trace communication traffic + | -Boundary regex used to detect message boundaries. If you are having problems with empty messages, missing + | attachments or anything like this. Be advised that it likes to break which causes new problems.. | -Message key identifier option - | You can choose between 'id', 'number' or 'list' + | You can choose between the following: | 'id' - Use the MessageID as array key (default, might cause hickups with yahoo mail) | 'number' - Use the message number as array key (isn't always unique and can cause some interesting behavior) | 'list' - Use the message list number as array key (incrementing integer (does not always start at 0 or 1) @@ -132,9 +142,13 @@ 'options' => [ 'delimiter' => '/', 'fetch' => \Webklex\PHPIMAP\IMAP::FT_PEEK, - 'sequence' => \Webklex\PHPIMAP\IMAP::ST_MSGN, + 'sequence' => \Webklex\PHPIMAP\IMAP::ST_UID, 'fetch_body' => true, 'fetch_flags' => true, + 'soft_fail' => false, + 'rfc822' => true, + 'debug' => false, + 'boundary' => '/boundary=(.*?(?=;)|(.*))/i', 'message_key' => 'list', 'fetch_order' => 'asc', 'dispositions' => ['attachment', 'inline'], @@ -145,12 +159,12 @@ "sent" => "INBOX/Sent", "trash" => "INBOX/Trash", ], - 'open' => [ - // 'DISABLE_AUTHENTICATOR' => 'GSSAPI' - ], 'decoder' => [ 'message' => 'utf-8', // mimeheader 'attachment' => 'utf-8' // mimeheader + ], + 'open' => [ + // 'DISABLE_AUTHENTICATOR' => 'GSSAPI' ] ],