Search code examples
emailsmtpimappop3fetchmail

How do Apple Mail and Thunderbird apps fetch emails in real time?


I am trying to read my emails from a terminal using fetchmail, procmail and mutt. I can fetch my emails almost in real time using fetchmail daemon to fetch every 5 seconds over IMAP or POP. This solution works on both Mac and Linux, but I would like to know if there is a better way to do this.

I used Thunderbird and Apple Mail before, and they both fetch emails almost in real time. Are they both using fetchmail constantly? Is there a way to avoid pinging my email server every 5 seconds? Maybe a socket-based solution or something like that?


Solution

  • Many IMAP servers support IMAP IDLE command. The command allows to get "near real time" notifications about new messages in selected IMAP folder (e.g. INBOX). You keep IMAP session open and server notifies you about new messages.

    fetchmail supports IMAP IDLE.