On 1 Jul 2006 08:29:51 -0700, LJ <[EMAIL PROTECTED]> wrote: >Hello, > >I'm trying to monitor my gmail account to know when I have obtained a >new email. It seems that once I have logged in, I should be able to >call the stat() function repeatedly to see how many messages are in my >inbox. The problem is that this number does not seem to update until I >have logged out, and logged back in. In other words, I run the code >below, send myself an email, and observe that the count does not >change. If I kill the program and restart (hence logging back in), >then the total count is now updated. The other function calls seem to >work the same way (eg "list" just shows the same list, even when I know >new mail has arrived). > >Questions: >1. is this a standard behavior of pop protocol? (to give me the same >results for any API call on a single login?)
Yes. >2. OR is this a peculiarity of gmail Nope. >3. is there a more efficient and correct way to see know when I have >received a new mail? Currently my "working" method is to log out and >log back in. With this method, I can get about 17 refreshes per minute >but anything faster and Gmail blocks me for a few minutes. (yes it is >important to my application that I have very frequent refreshes). This is not the purpose for which POP3 was intended. POP3 is expected to be used when a latency of several minutes doesn't make much difference. If you look at the capabilities gmail's POP3 server publishes, you even see they are declaring a five minute login delay. This is intended as a hint to clients that logins more frequent than one per five minutes are not allowed. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list