Right now, there's a per-run limit, because each message being checked requires that much more RAM. Making this more smart would be a good idea, so it could make it all the way through a mailbox without using a lot of RAM.
A way to do this might be to wrap things in a loop and do 1000 messages at a time. Or, using a temp file to store the FETCH results from the server and then iterating through there could do the trick.
Right now, there's a per-run limit, because each message being checked requires that much more RAM. Making this more smart would be a good idea, so it could make it all the way through a mailbox without using a lot of RAM.
A way to do this might be to wrap things in a loop and do 1000 messages at a time. Or, using a temp file to store the FETCH results from the server and then iterating through there could do the trick.