128 Part II — Getting Inside Gmail
Using the Library
The Mail::Webmail::Gmail module is remarkably simple to use and very thor-
ough. You’ll be using it extensively in the next few chapters, so here we shall just
summarize the options.
Logging In
The standard call for logging into Gmail session is:
my $gmail = Mail::Webmail::Gmail->new(username => ‘username’,
password => ‘password’, );
That call can also take some optional arguments. If given the details, you can use a
proxy server, and you can also encrypt the entire session as opposed to just the
login sequence. Call them all like so:
my $gmail = Mail::Webmail::Gmail->new(
username => ‘username’,
password => ‘password’,
proxy_username => ‘proxy_username’,
proxy_password => ‘proxy_password’,
proxy_name => ‘proxy_server’,
encrypt_session => 1
);
Once logged in, you can make requests for data and pass methods on the Gmail
Inbox. There are lots of methods that you can use.
The Other Functions
This chapter provides only a table of the available functions (see Table 7-4). They
are more fully explained as you use them in the rest of the book.
Table 7-4 The Functions Within Mail::Gmail::Webmail
Function What It Does
get_labels() Retrieves an array of the labels in the account.
edit_labels (label=> Creates the label ‘label name’.
’label_name’, action =>
‘create’);
edit_labels( label => Renames the label ‘label_name’to ‘renamed_label’.
‘label_name’, action =>
‘rename’, new_name =>
‘renamed_label’ );