Hack 77. Gmail on the Go

mobile phone, that is .Web mail means
never having to say you're sorry that you left your
laptop at home. While I can't quite fathom it
myselfI keep a lot I need beyond basic email on my
laptopthere are those that wander the world sans the very core
of the mobile office. They're happy to use
OP's (other people's).
"Where there's a web browser,
there's a way" is their credo, and
for those who can swing it, more power to them.Where this falls down for me are the between times: dashing to a
meeting without the latest agenda in hand (it's in
my email inbox, but my laptop's in my bag and
there's no wireless network in sight), meandering a
foreign city and wanting to keep in touch with the folks back home
but without having to lug around a laptop, and other moments such as
these.The browser experience on even the smartest of smartphones has a way
to go. And most folks don't have any more of the
Internet on their phones than a basic text-only WAP view of the world
Hack #67 . While WAP works to
some degree, web mail services don't tend to spend
much time, if any at all, on providing a WAP interface to your email.But there's always a workaround ...Gmail-mobile
(http://sourceforge.net/projects/gmail-mobile;
GNU Public License) is a PHP (http://www.php.net) application that sits on
your web site, between your mobile phone's WAP
browser and Gmail, brokering requests on your behalf and returning a
mobile-appropriate view of your Gmail mail.
|
Gmailand there are more features promised.
6.10.1. Installing the Hack
Installing gmail-mobile is a piece of cake; I installed it under both
Mac OS X and Linux in a matter of seconds each.
|
and unpack the distribution (0.11 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-mobile-0.11
.tar.gz
gmail-mobile-0.11/
gmail-mobile-0.11/AUTHORS
gmail-mobile-0.11/COPYING
gmail-mobile-0.11/INSTALL
gmail-mobile-0.11/README
gmail-mobile-0.11/TODO
gmail-mobile-0.11/compose.php
gmail-mobile-0.11/config.php
gmail-mobile-0.11/index.php
gmail-mobile-0.11/libgmailer.php
gmail-mobile-0.11/logout.php
gmail-mobile-0.11/main.php
gmail-mobile-0.11/star.gif
$ mv gmail-mobile-0.11 gmail-mobile
|
just how easy it was.By default, gmail-mobile uses browser cookies to maintain state
between requests to Gmail's servers. If you have PHP
Session (http://www.php.net/session) installed, you
can choose to use it instead of cookies. Just comment out the
appropriate line in the config.php file in your
newly unpacked gmail-mobile directory. Here,
I've left things as they were, using the cookie
default:
<?php
require_once("libgmailer.php");
/** Session handling method. You must at least choose (uncomment) one. **/
/**** have PHP Session installed, prefer to use cookie to store session **/
//$config_session = (GM_USE_PHPSESSION | GM_USE_COOKIE);
/**** have PHP Session installed, prefer NOT to use cookie **/
//$config_session = (GM_USE_PHPSESSION | !GM_USE_COOKIE);
/**** do not have PHP Session installed **/
$config_session = (!GM_USE_PHPSESSION | GM_USE_COOKIE);
?>
6.10.2. Running the Hack
With the easy part out of the way (isn't it
wonderful when installation and configuration is the easy part?)
you're ready to break out your mobile
phone's browser and muddle through typing on that
minute keypad.Before trying this out from your mobile phone (and to remove one
variable in case something doesn't work as
expected), point your computer's web browser at a
URL corresponding to the gmail- mobile directory on your web
sitee.g.,
http://www.example.com/~rael/gmail-mobile .
|
it'll serve up the raw WML source delivered by
gmail-mobile, as shown in Figure 6-23, or
it'll throw up its hands in confusion and prompt you
to save the source as a file on your hard drive. If the source
(displayed in your browser or saved and opened using something like
TextEdit on Mac OS X or Notepad on Windows) looks something like
Figure 6-23 and doesn't seem to
report any PHP or other errors, you're ready to
switch to your mobile phone.
Figure 6-23. Raw Gmail Mobile WAP as viewed through a regular browser

appropriate URL to reach the gmail-mobile
directory on your web site, as above.After a few moments of churning (WAP is lightweight, but most mobile
bandwidth is on the light side too), you should be greeted with a
login screen (Figure 6-24, left). Key in your Gmail
login
(username@gmail.com)
and password, alter the time zone if you feel so inclined, and click
OK. Just where you find OK will vary from phone to phone, WAP browser
to WAP browser. I found it under the left soft key
options
Figure 6-24. Log in to Gmail Mobile from your mobile's WAP browser (left) and click OK (right)

your Gmail account (Figure 6-25, left). To visit any
of the folders, navigate over the appropriate link and select it,
much as you would links in a regular browseralbeit with
esoteric keystrokes rather than a mouse. Figure 6-25, right, shows my rather empty inbox.
Figure 6-25. Take a gander at a summary of the state of your Gmail (left) and visit your inbox (right)

email message) in any of your mailboxes by selecting its link.
Compose a new message by selecting the Compose link; reply using the
Reply link at the bottom of a message. Figure 6-26,
right, shows the composition window in action.
Figure 6-26. Read (left) and respond to (right) Gmail mail on the go

writing) create, alter, or delete Gmail labels, you can see what they
are (Figure 6-27, left) by following the Labels link
on the Summary screen (Figure 6-27, right, shows all of my messages labeled
"Peeps."
Figure 6-27. Browse your Gmail labels (left) and visit labeled messages (right)

you've come to expect, but it's a
great way to take your Gmail with youand, quite frankly,
it's better than some of the mobile email
applications that I've come across.
6.10.3. See Also
The gmail-mobile project has on its to-do list just about anything
you're currently wishing for, including search,
archive, delete, forward, label, mark as spam, and working with the
Gmail address book Hack #73 . Keep an
eye on the project page (http://sourceforge.net/projects/gmail-mobile)
for the latest news and distributions. If you're new to mobile browsing, you might want to
take a gander at [Hack #67] .