Tuesday 18 January 2011

Gmail Push: instant notification of new email

Just a quick note about setting up 'push' email delivery on Gmail accounts.  This feature gives you instant notification of incoming emails, without the need to poll frequently via POP or IMAP.  There are two different ways to set it up, depending on the mail client you use...

I can confirm Gmail Push mail notification as working on Mozilla Thunderbird (Mac and Linux), Apple Mail (Mac), Apple Mail (iPad), and Apple Mail (iPhone).  The Mozilla Thunderbird approach should also work on Windows.  I don't know about Microsoft's own mail clients, as I've learnt to avoid them over many years.

The first thing to say is that it's time to stop using POP3 to retrieve email on any of your computers.  The problem with POP3 is that it doesn't work well when you have more than one computer accessing the same mail account: once you've retrieved a piece of mail, it's deleted from the server (unless you tweak the settings - but that makes for slow downloads).   The mail retrieval protocol of choice for most people is IMAP.  If you switch from POP3 to IMAP, then your mail stays on the server, and each time you connect with your mail program, it just downloads any stuff it hasn't already got.    A good IMAP client will also copy send mail into an IMAP Sent Items folder, so that whichever computer you use, you get a consistent view of mail sent and received.  The free Google Mail service implements IMAP particularly well; offers plenty of storage space (7 GB per user if I recall correctly); has excellent spam filtering; and is highly recommended.   So - to begin with - if you're going down the Push Email route, I'd recommend switching to Gmail with IMAP to begin with, if you haven't already done so.   Of course, once you have a Gmail account, you can use it with any ISP.

So - how can Push email be configured to give you instant email notifications with Gmail?   The following variations are working here (January 2011):-
  • Mozilla Thunderbird v3.1.7 for Mac (also working on Ubuntu Linux): for Thunderbird I think it's best to access Gmail using IMAP.  The key setting for instant email notification is "Tools", "Account Settings", (mailbox name), "Server Settings", "Advanced", "Use IDLE command if the server supports it".
  • Apple Mail (v4.4 on MacOS 10.6.5): again, this works well with IMAP.  Unde "Mail", "Preferences", (account name), just enable POP, and tick the box "Use IDLE command if the server supports it".
  • Apple iPhone / iPad Mail iOS v4.2.1: this platform can access Gmail really efficiently using the Microsoft Exchange protocol (it seems efficient in use of bandwidth, and it allows easy syncing on Contacts and Calendars too).  It's configured by going into Settings, "Mail, Contacts, Calendars", "Add Account", then picking "Microsoft Exchange".   Follow the help on Gmail's help pages for the correct settings.   
    • NOTE 1: whilst in general, most Google Mail users can use "gmail.com" instead of "googlemail.com", for some reason my wife's account could only be configured successfully on the iPad when the username@googlemail.com format was used for the username of the Microsoft Exchange account.
    • UPDATE 20/08/2012:  Gmail now appears to have broken MS Exchange Sync for newly-configured iPhones.  At home my wife and I have two iPhone 4S handsets both running IOS 5.1.1.  My iPhone was set up many months ago, and it continues to sync perfectly with Gmail using Exchange in Push mode.  My wife's new iPhone can't do this!  Configuration appears to work (green tick for correct password etc) but she then gets Invalid Password popups soon afterwards.  From Google's help pages, it appears that two-factor auth must be enabled; an app-specific password must be generated; and iPhone mail must be enabled as a permitted app.  But doing all three steps fails to resolve the password errors.  So, for my wife's phone, Gmail only works by entering the mail account type as "Gmail" (i.e. IMAP) - which means that the phone checks for email every 15 minutes.  I guess one workaround would be to switch to iCloud (e.g. forward her existing Gmail account to an iCloud mail account) - but I'm not sure whether we would still be able to share a single Apple account for calendars, contacts and app purchases. 
    • UPDATE 24/08/2012: It turns out that you can have several iCloud accounts - e.g. one for email and one for everything else - which suits our use case at home.  You get a free @me.com email address from Apple (soon to be renamed @iCloud.com apparently).   When we set this up, the push email feature worked immediately on the Mac, but didn't start working for a day or two on the iPhone (i.e. the email worked but the Push feature didn't work at first).
    • NOTE 2: on the iPhone and iPad, whilst you're setting up email sync via Microsoft Exchange, you can also enable sync of Contacts and Calendars to Google.  This is very handy, as it provides much of the "everything everywhere" type functionality of Apple's MobileMe service without having to pay a subscription fee.  If you also use Apple's Calendar and Contacts programs on the Mac, you just need to take care to set them to use Google's servers, instead of just storing your data locally.
    • NOTE 3: in iTunes, make sure your local email store (laptop or desktop) isn't set to sync with your iPhone or iPad.  You don't need local email sync in iTunes if you're syncing your email directly with Google's servers.   The same goes for Contacts and Calendars: you don't need to sync those in iTunes if you're syncing directly to Google's servers.
Google's help pages offer lots of detailed instructions on setting things up.  Not everything is obvious.  For example, it's worth understanding the difference between archiving an email [recommended] and deleting it [not recommended].

It's quite impressive if I send myself a test email.  Within seconds, my iMac, MacBook, iPad and iPhone will all "ding" to indicate that a new email has arrived.  This is especially impressive on the iPad and iPhone, as these work even when they are sleeping, and are using cellular data connections rather than WiFi.

By the way, I reckon Mozilla Thunderbird and Apple Mail work equally well on the Mac.  If you need to use PGP to email commercial documents around, then Thunderbird has the edge, as it supports PGP directly via the free GPG Enigmail plug-in.  For PGP support in Apple Mail, you'd need to buy PGP Desktop for Mac - but as I've mentioned elsewhere in this blog, PGP Desktop for Mac doesn't integrate tightly with the Apple Mail client (it uses a localhost proxy server instead) so it's not as straightforward or reliable as the Thunderbird/Enigmail combination.

PS: For iPhone, see http://www.google.com/mobile/sync/ for more info.

Hope this is useful!

No comments:

Post a Comment

Spammers: please stop wasting my time. All comments are moderated before publication.