Dealing with
Labels
Y
ou can receive mail and you can send mail, but you have
yet to play with Gmail’s main feature — its immense stor-
age capacity. You’ll be using that over the next few chap-
ters. One of the biggest draws to Gmail is the way you organize
mail with labels. Labels are quite the fashionable thing on the
Internet at the moment: Whether you call them labels or the
commonly used idea of tags, it really doesn’t matter. Gmail’s sys-
tem works in the same way as the other cult Web 2.0 sites, Flickr
and del.icio.us.
In this chapter, then, you look at working with the labels pro-
grammatically, listing them, setting them, changing them, and
deleting them.
Listing the Existing Labels
The simplest thing you can do with labels is list the ones you are
already using. Listing 11-1 shows a script to do just that. It uses
the Utils.pm module created earlier in the book, as do the rest of
the scripts in this chapter.
You can find Utils.pm, if you don’t have it already, in
Listing 7-4.
The script is too simple to require any explanation, but just note
that it uses Mail::Webmail::Gmail’s get_labels()function to
return an array.
̨Listing existing
labels
̨Setting and editing
labels
̨Deleting old labels
chapter
in this chapter