This morning I saw that an iPhone app appeared on the app store that provides iPhone push notifications for Gmail. After looking into this a bit it looks like the GPush app sends your username and password to the GPush server and from their servers keeps an IMAP IDLE connection to Gmail open. Whenever Gmail signals a new email to the GPush server, GPush triggers an iPhone push notifications via Apple's Push Notification Service (APNS).
I really don't like the idea of some unknown company having my Gmail credentials and being logged into my gmail account all the time, so I built a proof-of-concept of the same thing that I can run on my own server. I used the following code:
Python imaplib2 from http://www.cs.usyd.edu.au/~piers/python/imaplib2
example IMAP IDLE server from http://blog.hokkertjes.nl/2009/03/11/python-imap-idle-with-imaplib2/
APNS code based on examples from Apple iPhone developer forum postings
You can find the proof-of-concept code for client and server on github
To try this you need to have an iPhone developer account, create a Push Notification provisioning profile and have a server that runs python 2.6.