We’r developing an automated attachment saver system (you send a mail to a predefined email address and the attachement gets saved to your account). The retrieval of the emails will be done through IMAP.
My question is, which is the best (in terms of system resources): to have an active TCP/IP connection to the mail server and send a NOOP command every minute, or to log in and query the status every minute than log out/close the connection? (The system must run 24/7)
Our system: Windows server
Mail server: Gmail
We went with IMAP4’s IDLE command, as GMail supports it.
In short, after sending an IDLE command to the server, the server will notify the client as soon as a new mail arrives (or is deleted/EXPUNGED). It’s real-time and it uses few resources.