ddeboer / imap

Object-oriented, fully tested PHP IMAP library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Too big mail exception

marcoberetta96 opened this issue · comments

Q A
ddeboer/imap version 1.10.0
PHP version 7.2.*

Hi,

I noticed an issue happening when fetching a big mail (more than 100 MB).
The mail can't be fetched and any method called on this mail causes the IMAP connection to be closed.
Even the getId method breaks the IMAP connection.

I tried to catch a generic Exception in order to allow the other messages to be fetched, but this does not solve the issue.
For all the other messages, the methods getRawHeaders() and getRawMessage() always return NULL.

I also tried to manually skip the first mail (the big one) by adding
$messageNumbers = array_slice($messageNumbers, 1);
in the constructor of MessageIterator and this solves the issue.
Big mail is skipped and the other mails are fetched correctly.

It would be nice if an exception like MailTooBigException is triggered when the problem arises, and the other mails could be fetched normally.

Thanks!

You are right: if you find a way to do it, please ping me 🤔