advertisement

Print

Hacking Google
Pages: 1, 2, 3, 4, 5

Take a Walk on the Lighter Side

Gmail with grace from any web browser, whether JavaScript-disabled, not yet supported, text-only, or on a PDA or mobile phone.

Being a child of Google, Gmail hides all of its complexity behind a rich, deep, feature-packed yet user-friendly web mail interface, assuming you have the right browser—one of recent vintage—for the job. But what to do if your IT department hasn't upgraded your version of the Internet Explorer browser since Windows 95, you're quite happy with the text-only Lynx browser, you're running the latest nightly build of browser XYZ, which Gmail simply doesn't like, or you're trying to reach your mail from a PDA or smartphone?

Gmail-lite (home page: http://sourceforge.net/projects/gmail-lite, SourceForge project page: http://sourceforge.net/projects/gmail-lite; GNU Public License), as the name suggests, puts a plain HTML face on Gmail. It is a PHP application that proxies your interactions with Gmail, allowing you to surf using whatever browser you have at hand or just plain prefer just plain prefer, while keeping Gmail happy with its end of the conversation.

The authors of gmail-lite have done a fantastic job, affording you a plain HTML interface to just about every bit of functionality Gmail provides through its more interactive JavaScript-based frontend.

Installing the Hack

You have to marvel at the wonders of PHP-based applications and their simple installation. Assuming you have the prerequisites taken care of, it's just a matter of downloading, unpacking, and enjoying. I installed gmail-lite both on my local Mac OS X laptop and under my hosted ISP account in seconds each.

TIP: Gmail-lite assumes you have PHP installed on a web server. It relies upon the libgmailer library (http://gmail-lite.sourceforge.net), included for your convenience in the gmail-lite distribution. You also need the curl library (http://www.php.net/curl) with SSL support (http://www.openssl.org) since gmail-lite always talks to Gmail over a secure channel.

Download gmail-lite (http://sourceforge.net/projects/gmail-lite) and unpack the distribution (0.56 at the time of this writing, but yours is sure to be a later version) somewhere under your web server's document root, where the rest of your web site lives (ask your system administrator or service provider if you're not sure where this is):

$ tar -xvzf gmail-lite-0.56.tar.gz 
gmail-lite-0.56/
gmail-lite-0.56/compose.php
gmail-lite-0.56/config.php
gmail-lite-0.56/debug.php
gmail-lite-0.56/diagnose.php
gmail-lite-0.56/dl.php
gmail-lite-0.56/docs.html
gmail-lite-0.56/index.php
gmail-lite-0.56/INSTALL
gmail-lite-0.56/libgmailer.php
gmail-lite-0.56/logout.php
gmail-lite-0.56/main.php
gmail-lite-0.56/star.gif
$ mv gmail-lite-0.56 gmail-lite

TIP: That last command simply renames the directory to something that will be a little friendlier and easier to remember when it comes to visiting in my browser.

To verify that everything went to plan, point your web browser at diagnose.php using the URL corresponding to the gmail-lite directory on your web site—e.g., http://www.example.com/~rael/gmail-lite/diagnose.php The resulting page should look like Figure 6-18.

Figure 6-18
Figure 6-18. The diagnose.php script makes sure that everything is installed as expected

If diagnose.php does indicate that something's gone wrong, consult the installation and troubleshooting documentation in the INSTALL text file in your gmail-lite folder.

Running the Hack

Point your computer's web browser at the URL corresponding to the gmail-mobile directory on your web site—e.g., http://www.example.com/~rael/gmail-lite (or just click the "Press here..." link on the diagnose.php page).

WARNING Depending on your setup, you may actually need to tack /index.php on to that URL, but most PHP-enabled servers know to look for and serve up index.php as a default when no filename is specified and there's no static index.html in sight. The gmail-lite package includes just such an index.php file.

Figure 6-19 shows the plain HTML login screen as it will appear in a typical browser window. Enter your Gmail login (e.g., username@gmail.com) and password, alter the time zone if you feel so inclined, and click the "sign-in" button.

Figure 6-19
Figure 6-19. A gloriously plain HTML Gmail login page in a typical browser window

You're greeted with a summary page with links to your Gmail Inbox, Sent, Trash, and Spam folders, Starred messages, and personal labels—shown in Figure 6-20 as it appears in a smartphone XHTML web browser.

Figure 6-20
Figure 6-20. A summary of the state of your Gmail account as it appears in a smartphone XHTML browser

Click the Inbox link and you'll be presented with a simple list of your incoming messages, as shown on a Pocket PC in Figure 6-21. At the top is a quick-link toolbar and pull-down menus for switching views, exploring labeled mail, and searching your Gmail messages ["Gmail Search Syntax" earlier in this chapter]. (Click the Get button after making your selections or entering a search query.) At the bottom are actions you can apply to any number of checked messages (check the associated checkbox to the right of a message subject to act upon it), including archive/unarchive, label, star/unstar, mark as read/unread, mark/unmark as spam, and trash/untrash. (Click the Do button to apply any action.)

Figure 6-21
Figure 6-21. Your Gmail inbox, as seen through a Pocket PC

Select any email message to open it. Figure 6-22 shows a typical email message viewed in the text-only Lynx browser. The layout of individual message pages is much like that of the Inbox (or any folder) view. As you can see in the figure, I'm about to take a look at all my "foo"-labeled messages.

Figure 6-22
Figure 6-22. An individual message in the Lynx text-only browser

So, there you have it: a plain old HTML interface to about anything you can do through Gmail proper. (In all likelihood, by the time you read this, Gmail will have built its own plain HTML version without all the browser and JavaScript requirements. Still, this is a great hack and worth fiddling about with.)

WARNING The gmail-lite author does caution that "GMail is a still in beta, and GMailer (along with gmail-lite) is, I would say, an `alpha hack' of a beta software. So don't expect it to work all the time, and do not build critical mission applications upon it" (http://gmail-lite.sourceforge.net/).

See Also

If you're wanting to Gmail from a mobile phone with only a very basic WAP browser on board, you can still Gmail on the go with gmail-mobile [Hack #77]. And be sure to check out [Hack #67] for taking Google search along too.

Pages: 1, 2, 3, 4, 5

Next Pagearrow