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

How to solve Invalid Message Date

Open dannylifino opened this issue 3 years ago • 2 comments

Our company is currently automatically fetching our inbox messages using: $inboxMessages = $this->inboxFolder->messages()->all()->get();

Occassionaly, we get a bad message in there with an invalid message date, which throws an error and terminates the whole script. If this happens, we manually clear out our inbox that consists of like 500+ messages a day. This is a real struggle, because if we get this error, we have to spend a lot of time searching and fixing it.

Error: GetMessagesFailedException Invalid message date. ID: Date:Di., 15 Feb. 2022 06:52:44 +0100 (MEZ)/Di., 15 Feb. 2022 06:52:44 +0100 (MEZ)

Is there some sort of way that we can skip these messages from fetching or like delete them, without editing your whole package @Webklex ?

dannylifino avatar Feb 16 '22 21:02 dannylifino

@Webklex do you know of an easy fix for this, that i can implement at this particular moment?

dannylifino avatar Feb 17 '22 19:02 dannylifino

Hi @dannylifino , many thanks for your report. Is this Di., 15 Feb. 2022 06:52:44 +0100 (MEZ)/Di., 15 Feb. 2022 06:52:44 +0100 (MEZ) the actual date string or a combined string from two different messages?

This is our current collection: https://github.com/Webklex/php-imap/blob/0897d64c86eb69cd55d18d2fee2e390868429787/src/Header.php#L708-L744

Please feel free to add an additional rule.

You can also disable this behavior by providing a fallback date fallback_date within your config: https://github.com/Webklex/php-imap/blob/0897d64c86eb69cd55d18d2fee2e390868429787/src/config/imap.php#L154

Best regards & happy coding,

Webklex avatar Aug 19 '22 10:08 Webklex

Same here, I got the similar exception quite often

'Invalid message date. ID*** Date:fr., 25 nov. 2022 06:27:14 +0100/fr., 25 nov. 2022 06:27:14 +0100'

sergiy-petrov avatar Dec 07 '22 20:12 sergiy-petrov

I have same problem on 5.5.0 version :( This is error message: Invalid message date. ID:[email protected] Date:Tue, 22 Feb 2024 19:23:29 +0000k5b3sk0m/Tue, 22 Feb 2024 19:23:29 +0000k5b3sk0m

jazz-max avatar Feb 29 '24 19:02 jazz-max