I plan to develop pub/sub feature, where do I begin?

Hi,
I use MIAB to receive emails mostly, and I want my program to receive the emails as soon as it arrives in MIAB. The program create more than 1,000 email addresses, it’s something similar to HubSpot inbox, each user has an email, if that matters. I’m using an imap client, written in nodejs, to observe whenever there’s a mail to each mailbox and then pull.

However, each imap connection keeps disconnected after every 3-5 minutes. After digging around, it looks like I shouldn’t do that (?)

According to wikipedia, Internet Message Access Protocol - Wikipedia

When using IMAP4, clients often stay connected as long as the user interface is active and download message content on demand

So, I plan to change the code inside MIAB, allow it to create a publish message via a Socket IO server, then my Socket IO client just listen to that. Point is: MIAB doesn’t have to keep the imap client connections open all the time, let the Socket IO server do the job of broadcasting to clients.

I’ve read and found there are many components: dovecot, postfix, .etc. Where should I start digging and develop the feature, thanks.

The code is published in the GitHub:

1 Like

In viewing the log files over the years, my observation has been that the client connects, checks for mail, retrieves it (if any) then disconnects. Then checks again 1 minute later. At least this is the behavior of the Roundcube web mail client provided with MiaB.

1 Like