Hacking Gmail

(Grace) #1

Chapter 7 — Gmail Libraries 131


Function What It Does

send_message( to => Sends a message to a single recipient.
[email protected]’, To send to multiple users, send an arrayref containing all of the
subject => ‘Test Message’,users:
msgbody => ‘This is
a test.’ );
my $email_addrs = [
[email protected]’,
[email protected]’,
[email protected]’, ];
$gmail->send_message( to => $email_addrs,
subject => ‘Test Message’, msgbody => ‘This is a
test.’ );
send_message( to => Sends a message with an attachment.
[email protected]’,
subject => ‘Test Message’,
msgbody => ‘This is a
test.’, file0 => [“/tmp/
foo”], file1 => [“/tmp/
bar”] );
delete_message Sends a message to the Trash.
( msgid => $msgid, del_
message => 0 );
delete_message( msgid => Permanently deletes the message.
$msgid );

The rest of this module is covered in Chapter 8 onwards.


Python — Libgmail


The trifecta of scripting languages beginning with P ends with ython, and is com-


pleted by Libgmail, the Python bindings for Gmail access.


Getting and Installing the Library.


Libgmail is hosted on Sourceforge at http://Libgmail.sourceforge.net/
and can be downloaded directly from there. The authors of Libgmail advise using


the version from CVS if possible, as it is more likely to work with whatever


changes Google has made to the service lately. Figure 7-3 gives the traditional
screenshot of the project’s homepage.

Free download pdf