idle.pl - example using IMAP idle
Options: [*] == Required, [+] == Multiple vals OK, (val) == Default --o Server=<server> *IMAP server name/IP --o User=<user> *User account to login to --o Password=<passwd> *Password to use for the User account (see security note below) --o Port=<port> port on Server to connect to --o Ssl=<bool> use SSL on this connection --o Starttls=<bool> call STARTTLS on this connection --o Debug=<int> enable debugging in Mail::IMAPClient --o ImapclientKey=Val any other Mail::IMAPClient attribute/value pair --folder <folder> folder (mailbox) to IMAP SELECT (INBOX) --maxidle <sec> maximum time to idle without receiving data (300) --help display a brief help message --man display the entire man page --debug enable script debugging
A password specified as a command-line option may be visible to other users via the system process table. It may alternately be given in the PASSWORD environment variable.
RFC 2177 states, "The server MAY consider a client inactive if it has an IDLE command running, and if such a server has an inactivity timeout it MAY log the client off implicitly at the end of its timeout period. Because of that, clients using IDLE are advised to terminate the IDLE and re-issue it at least every 29 minutes to avoid being logged off."
The default of --maxidle 300 is used to allow the client to notice when a connection has silently been closed upstream due to network or firewall issue or configuration without missing too many idle events.