Gmail Libraries
I
n the previous chapters, you discovered how Gmail works: how
it loads into your browser, and how it handles your mail
through a series of JavaScript tricks and the passing of data in
the background. You can use this newfound knowledge to take
control of the application from within your own programs.
To do that, you need to use a library— a piece of code that
encapsulates the nitty gritty of the interaction between your pro-
gram and Gmail itself in such a way that it makes writing that
program very easy. Instead of, for example, having to write code
that requests the Inbox’s JavaScript array, parses it, finds the mes-
sage identity, requests the thread, parses that, and finally displays
it on the screen, you can simply run the function to download the
next unread mail.
This approach, of wrapping complex activities up into their own
simpler-to-use functions, is one of the bases of software engineer-
ing, so it’s not surprising that there are already many such mod-
ules for Gmail. This chapter examines examples for PHP, Perl,
And Now
As with all of the code in this book, these libraries are
dependent on Gmail’s code standing still for a while.
Google, on the other hand, likes to keep improving
things. You may find that the APIs don’t quite work
when you try them. Usually this is because Google has
changed the login procedure to Gmail, or something
simple like that. Give it a few days, and you will proba-
bly find that the API’s authors or user community has
hacked up a run-around.
̨What is a library?
̨Accessing Gmail
with PHP
̨Accessing Gmail
Sending Mail with Perl
̨Accessing Gmail
with Python
chapter
in this chapter