Hacking Gmail

(Grace) #1

200 Part III — Conquering Gmail


Listing 14-2 (continued)

}

$inbox->sync();
$inbox->close();

Running the script, as ever, produces an mbox file in the directory in which it is
run. This one is called “inbox” and will contain the contents of your Gmail Inbox.

From the previous chapters, it should be easy to see how to vary this script to
deal with mail in the archive or with a specific label.

Apple Mail.app, Thunderbird, and Entorage and Eudora can all deal with
importing Mbox files directly. Outlook, however, cannot. It requires an .idx file for
each folder, which contains an index of the mails within. It’s easy to produce one
of these, however: Simply grab a copy of Eudora from http://eudora.com/
products/eudora/download/and import into there. Then rename the folder
in Eudora (and rename it back again if you like) to force it to produce an .idx file.
Then you can export from Eudora, and the .idx file that Outlook needs will be
there. A bit fiddly, yes, but that’s what you get for using Outlook.

Appending to IMAP


The Internet Message Access Protocol, or IMAP, is by far the best protocol for
accessing e-mails from a desktop client. Unlike POP3, IMAP allows you to keep
your mail on a server — folders, sub-folders and all — and access it from multiple
clients and devices. This means that you can, for example, have your mail synchro-
nized between your home and work desktop machines, your laptop, and your
phone. (Of course, Gmail does that too, without all the messing around, but who’s
quibbling at this point?)

It can be very useful to dump your Inbox into an IMAP account, and that’s what
Listing 14-3 does.
Free download pdf