Some time ago I developed a program for my own use to check Gmail and see if I had unread email. I called it GmailCheck and I was able to get most of the code I needed right here at the forums.
Soon after I found out that Google had developed a very similar utility (which is still available) although I did not actually use it myself I believe it does basically the same thing.
I also began to run into some unexplained results in my program (bugs) which I simply did not have the time to fix. Ultimately, I abandoned it and it has been sitting on my laptop ever since.
I received a request from a forum user asking if I could help him with developing something similar. Rather than do that I figure others might benefit so I'm making the source code available with no string attached.
If you can use it great, just be aware that it's not fully debugged and that I will not really be able to help you figure out any problems you may run into with the code.
The only change I have made before releasing it is to change my email account in the code. Any place you see "emailaddress%40gmail.com" you will need to change to your email account. I believe the %40 is the "@" sign so just replace the "emailaddress" portion.
You can download the source GmailCheck_PB.zip

Devildog