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

Message move sometimes work very slowly

Open markozgemini opened this issue 1 year ago • 2 comments

Hi,

I am using the latest version, i.e. 5.5.0.

I process a lot of messages from several mailboxes. All of them are Microfost and connected via oAuth.

My flow looks like this: I check if there is a new message in the inbox folder, if so, I download the attachment to my system and process it. At the end, I mark the message as read and move it to the folder:

$mail->addFlag('seen');
$mail->move('archived');

Unfortunately, sometimes I have situations where the transfer to another folder itself takes a very long time, currently on one mailbox it takes about 40-45 seconds to transfer one email. On another mailbox the same process takes about 7 seconds. I assume that there is a similar number of messages on both mailboxes, but I don't know how to check it.

Does anyone of you have an idea where such a big difference in transferring messages could come from?

markozgemini avatar Dec 03 '24 08:12 markozgemini

@markozgemini I had the same problem. I am pretty sure that Microsoft is the problem here. You probably have thounds of messages in archived. The more messages you have in archived the slower new messages get moved into this folder. So now I have a "pre-archive" folder where I move my messages into in a first step. Then I built a cronjob which moves messages from pre-archive to archive, keeping the pre-archive folder clean which results in faster moves in a first step. Hope this helps!

dariobednarski avatar Mar 29 '25 13:03 dariobednarski

@dariobednarski thanks for the post

For now I solved the problem by creating a new directory "archived with current date" for example archived-2025-03 and it helped but it is not a very elegant solution...

Thanks for your idea!

markozgemini avatar Mar 29 '25 14:03 markozgemini