draga79 / NotiMail

Server-side email notification manager using several push providers for real-time alerts. Conserve mobile battery without compromising on immediacy.
BSD 3-Clause "New" or "Revised" License
21 stars 1 forks source link

IMAP IDLE connection closes after a period of inactivity #4

Closed Amolith closed 1 year ago

Amolith commented 1 year ago

I don't know exactly how long it takes, but my IMAP server closes the IDLE connection after a long period of inactivity and I have to log into my VPS to restart the NotiMail daemon. It would be ideal if NotiMail handled receiving that signal and re-initiated the connection on its own without having to remote in and restart it.

The line I see in my logs is something like

* BYE IMAP server shutting down

and there's no activity after that line even when I send testing emails to myself.

draga79 commented 1 year ago

That's strange, as NotiMail should reopen the connection every 10 minutes. It's working fine on my servers and I didn't notice something like this, but I'm going to implement a check to see if the IMAP server has closed the connection. Which e-mail server are you using?

Amolith commented 1 year ago

Which e-mail server are you using?

I'm using my own email server. I set it up years ago following the ISPmail guide and have been using it since, upgrading and migrating through the various Debian versions and various guide versions.

draga79 commented 1 year ago

Ok, I think it's Dovecot, which is the same I'm using at the moment. I'm working on making the connection more robust and/or reconnect in case of problems.

draga79 commented 1 year ago

The line I see in my logs is something like

* BYE IMAP server shutting down

and there's no activity after that line even when I send testing emails to myself.

Ok, I've modified the code so the timeout is now 8 minutes (some servers kill before the 10 minutes standard time) and if a BYE is received, the connection gets closed and re-opened. Can you please test the latest code?

Amolith commented 1 year ago

Interesting. I'll give it a shot when I get back home this evening.

I might also poke around in the config and see if I can increase that timeout; I didn't realise my server was configured unusually in that regard.

draga79 commented 1 year ago

Interesting. I'll give it a shot when I get back home this evening.

I might also poke around in the config and see if I can increase that timeout; I didn't realise my server was configured unusually in that regard.

Another user had a similar problem. With the last modifications, the user seem to have solved, so I hope they'll solve for you as well.

Also note I've performed some more modifications, have a look at the changelog in the README.md - but nothing will break if you won't update the config.ini

Amolith commented 1 year ago

That did indeed resolve the issue! I updated last night and I'm still receiving notifications for emails almost 24 hrs later :)