It looks like this design is flawed.
My web app should check for new e-mails regularly (every 5 minutes). Manually, it works, though I still have to find how I can tell imap to move an email to another folder once done.
I was about to implement the automatic check with a Timer, but realised it would only work when at least one user is actively using the app (and when several are, each would check for emails in the background).
Basically, I’d have to keep one session running all the time. This triggered me a question: what does a web app do when no user at all is connected to it? Does it sleep or is something still running?
What would be the best way to keep a session (or at least, a thread) always running?