Page 1
Generated Documentation
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 2
Contents
Package gmAtom Procedural Elements
2
gmatom.php
2
Package gmAtom Classes
3
Class GmAtom
3
Var $messages
3
Constructor GmAtom
3
Method check
4
Method getMessage
4
Method receive
5
Method receiveAll
5
Method setMsgLimit
5
Method sortBy
6
Class GmCurlConnection
6
Var $password
6
Var $username
6
Constructor GmCurlConnection
7
Method connect
7
Method scrubConnection
7
Method setLabel
7
Method setLoginInfo
8
Class GmMessageInfo
8
Var $body
8
Var $date
9
Var $from
9
Var $id
9
Var $link
9
Var $msgNo
10
Var $subject
10
Var $timestamp
10
Constructor GmMessageInfo
11
Method getBody
11
Package gmTest Procedural Elements
13
check_inbox.php
13
check_multiple.php
14
receive_all_inbox.php
15
receive_default_label.php
16
receive_many_specific.php
17
Appendices
18
Appendix A - Class Trees
19
gmTest
19
gmAtom
19
Appendix B - README/CHANGELOG/INSTALL
20
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 3
README
21
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 4
Page 1 of 21
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 5
Package gmAtom Procedural Elements
gmatom.php
GmAtom library file.
This file contains 3 classes: GmCurlConnection (connection class), GmAtom (main
class, extends GmCurlConnection) and GmMessageInfo (individual message class).
Created on 7-Nov-06.
Package gmAtom
Author Vladislav Bailovic < malatestapunk@gmail.com>
Page 2 of 21
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 6
Package gmAtom Classes
Class GmAtom
[line 138]
This class does most of the work.
Package gmAtom
Author Vladislav Bailovic < malatestapunk@gmail.com>
GmAtom::$messages
mixed = array() [line 153]
This is where your messages will be stored.
Each message is represented by a GmMessageInfo object.
Access public
Constructor function GmAtom::GmAtom([$user = false], [$pass = false]) [line 163]
Function Parameters:
string $user Gmail username (no '@gmail.com')
string $pass Password for the user
Page 3 of 21
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 7
Constructor initializes parent class.
Username and password params are optional, but you have to provide them later on
using the setLoginInfo() method.
bool/int function GmAtom::check([$forceRefresh = false]) [line 193]
Function Parameters:
bool $forceRefresh Drop result chache and renew the connection
Checks the inbox for new messages and returns the count.
To save some execution time, connection is executed only the first time, and later calls
will test the cached result.
To check multiple accounts (or obtain the latest data), you can provide the optional
$forceRefresh parameter - this will drop the result cache and re-execute the connection.
Note: this method returns (bool)false on error, new messages count otherwise. That can
easily be 0, so be sure to test with '===' for success/failure.
Access public
(bool)false function GmAtom::getMessage([$no = false]) [line 261]
Function Parameters:
int $no Message to fetch (order value)
Gets the full message info (including the body excerpt) for the specified message only.
Access public
Page 4 of 21
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 8
bool function GmAtom::receive([$begin = 0], [$end = false], [$getBody = false]) [line 223]
Function Parameters:
int $begin Where to begin message processing (optional defaults to 0)
int $end Where to stop message processing (optional, defaults to _msgLimit property)
bool $getBody Fetch the message body excerpt as well
Recieves and populates the messages array.
The array is populated by messages between $begin and $end interval (both are
optional), which may come in handy for paging. If not supplied, $begin will default to zero,
$end to _msgLimit property.
By default, messages will be processed without body excerpt. If you wish to have the body
available right away, set the optional $getBody parameter to (bool)true.
Access public
bool function GmAtom::receiveAll([$getBody = false]) [line 247]
Function Parameters:
bool $getBody Fetch the message body excerpt as well
Recieves and populates the messages array with *all* new messages.
Access public
function GmAtom::setMsgLimit($limit) [line 171]
Function Parameters:
int $limit Max messages to process
Page 5 of 21
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 9
Sets the default message limit value.
bool function GmAtom::sortBy($what, [$reverse = false]) [line 280]
Function Parameters:
string $what Property name to use for sort
bool $reverse Sort reverse
Sorts the message array by the speicified property.
All properties of GmMessageInfo class are allowed. Optionally, the messages array can
be sorted in reverse.
Access public
Class GmCurlConnection
[line 21]
This class creates and populates curl connection.
Package gmAtom
Author Vladislav Bailovic < malatestapunk@gmail.com>
GmCurlConnection::$password
mixed = false [line 49]
GmCurlConnection::$username
mixed = false [line 48]
Page 6 of 21
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 10
Constructor function GmCurlConnection::GmCurlConnection([$user = false], [$pass = false]) [line 60]
Function Parameters:
string $user Gmail username (no '@gmail.com')
string $pass Password for the user
Constructor.
Username and password parameters are optional at this point, but then you *have* to
provide them later with setLoginInfo() method.
bool function GmCurlConnection::connect() [line 98]
Creates and populates curl connection.
You shouldn't call this function yourself.
Access protected
function GmCurlConnection::scrubConnection() [line 127]
Destroys connection and deletes result cache.
Access protected
function GmCurlConnection::setLabel($label) [line 87]
Function Parameters:
string $label Gmail label to check
Sets Gmail label to check.
Use this to check the contents of a particular label. With no label set, all new mail from
Gmail inbox is checked.
Page 7 of 21
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 11
function GmCurlConnection::setLoginInfo($user, $pass) [line 75]
Function Parameters:
string $user Gmail username (no '@gmail.com')
string $pass Password for the user
Sets login info for the user.
You may want to use this method to check multiple user gmailboxes. You have to use
this method if you haven't supplied username/password in constructor.
Access public
Class GmMessageInfo
[line 311]
Each object of this class represents a single message.
Package gmAtom
Author Vladislav Bailovic < malatestapunk@gmail.com>
GmMessageInfo::$body
mixed = false [line 366]
Message body excerpt = atom summary element.
Page 8 of 21
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 12
Access public
GmMessageInfo::$date
mixed = false [line 347]
Message date = atom modified element
Access public
GmMessageInfo::$from
mixed = false [line 341]
Message from = atom author/email element
Access public
GmMessageInfo::$id
mixed = false [line 323]
Atom id element.
Access public
GmMessageInfo::$link
mixed = false [line 360]
Link to a full message at Gmail = atom link[@href] value.
Page 9 of 21
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 13
Access public
GmMessageInfo::$msgNo
mixed = false [line 329]
Message number (relative ordering)
Access public
GmMessageInfo::$subject
mixed = false [line 335]
Message subject = atom title element.
Access public
GmMessageInfo::$timestamp
mixed = false [line 354]
UNIX timestamp representing message date.
Derived from date property.
Access public
Page 10 of 21
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 14
Constructor function GmMessageInfo::GmMessageInfo($msg, $msgNo) [line 375]
Function Parameters:
string $msg Raw entry atom element value
int $msgNo Message number
Constructor.
Access public
bool function GmMessageInfo::getBody() [line 399]
Populates the body from the raw entry.
Access public
Page 11 of 21
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 15
Page 12 of 21
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 16
Package gmTest Procedural Elements
check_inbox.php
Check Gmail Inbox example.
This just checks Gmail Inbox for new mail.
Created on 11-Nov-06.
Package gmTest
Author Vladislav Bailovic < malatestapunk@gmail.com>
include '../gmatom.php'[line 12]
Page 13 of 21
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 17
check_multiple.php
Check mail for multiple Gmail accounts.
Note the (bool)true parameter to check() method.
Created on 11-Nov-06.
Package gmTest
Author Vladislav Bailovic < malatestapunk@gmail.com>
include '../gmatom.php'[line 12]
Page 14 of 21
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 18
receive_all_inbox.php
Receive all mail from Gmail Inbox example.
Created on 11-Nov-06.
Package gmTest
Author Vladislav Bailovic < malatestapunk@gmail.com>
include '../gmatom.php'[line 11]
Page 15 of 21
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 19
receive_default_label.php
Receive default number of new messages from label 'mylabel'.
Note: no body excerpts are gathered in this example.
Created on 11-Nov-06.
Package gmTest
Author Vladislav Bailovic < malatestapunk@gmail.com>
include '../gmatom.php'[line 12]
Page 16 of 21
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 20
receive_many_specific.php
Receive specific number of new messages from Gmail Inbox.
Created on 11-Nov-06.
Package gmTest
Author Vladislav Bailovic < malatestapunk@gmail.com>
include '../gmatom.php'[line 11]
Page 17 of 21
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 21
Appendices
Page 18 of 21
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 22
Appendix A - Class Trees
Package gmTest
Package gmAtom
GmCurlConnection
GmCurlConnection
GmAtom
GmMessageInfo
GmMessageInfo
Page 19 of 21
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 23
Appendix B -
README/CHANGELOG/INSTALL
Page 20 of 21
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 24
README
* What is this?
------------------------------------------------------
GmAtom is made to be a quick and easy solution to a simple task of
programmatically checking new mail on Gmail accounts, using Gmail
Atom feeds.
* What can I do with this?
------------------------------------------------------
You can check for new mail on one or more accounts and obtain the basic
info on new messages - from, subject, date, link to full message and a
body excerpt. You can check new mail for the entire inbox, or just for
certain label(s).
For anything that exceeds this simple purpose, you're perhaps better off
using libgmailer:
http://gmail-lite.sourceforge.net/wordpress/index.php/about/libgmailer
* What do I need to run this?
------------------------------------------------------
You need curl PHP extension.
* How do I use this?
------------------------------------------------------
Check the examples in "examples" directory (please, do remember to provide
valid gmail username and password before you expect them to work). You can
also take a look at comments in the source, or run PhpDocumentor
(http://www.phpdoc.org) over it to get a more readable documentation.
* Aaargh! I've found a bug!
- OR -
* This GmAtom stuff is working fine for me.
- OR -
* Dis nuh workin.
- OR -
* Dude, I think you rock!
------------------------------------------------------
Let me know: malatestapunk@gmail.com
Page 21 of 21
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 25
Index
C
check_multiple.php
14
Check mail for multiple Gmail accounts.
check_inbox.php
13
Check Gmail Inbox example.
constructor GmMessageInfo::GmMessageInfo()
11
Constructor.
constructor GmCurlConnection::GmCurlConnection()
7
Constructor.
constructor GmAtom::GmAtom()
3
Constructor initializes parent class.
G
GmMessageInfo::$body
8
Message body excerpt = atom summary element.
GmMessageInfo::$date
9
Message date = atom modified element
GmMessageInfo
8
Each object of this class represents a single message.
GmCurlConnection::setLoginInfo()
8
Sets login info for the user.
GmCurlConnection::setLabel()
7
Sets Gmail label to check.
GmMessageInfo::$from
9
Message from = atom author/email element
GmMessageInfo::$id
9
Atom id element.
GmMessageInfo::$timestamp
10
UNIX timestamp representing message date.
GmMessageInfo::getBody()
11
Populates the body from the raw entry.
GmMessageInfo::$subject
10
Message subject = atom title element.
GmMessageInfo::$msgNo
10
Message number (relative ordering)
GmMessageInfo::$link
9
Link to a full message at Gmail = atom link[@href] value.
GmCurlConnection::scrubConnection()
7
Destroys connection and deletes result cache.
GmCurlConnection::connect()
7
Creates and populates curl connection.
GmAtom::getMessage()
4
Gets the full message info (including the body excerpt) for
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu

Page 26
the specified message only.
GmAtom::receive()
5
Recieves and populates the messages array.
GmAtom::check()
4
Checks the inbox for new messages and returns the count.
GmAtom::$messages
3
This is where your messages will be stored.
GmAtom
3
This class does most of the work.
GmAtom::receiveAll()
5
Recieves and populates the messages array with *all* new messages.
GmAtom::setMsgLimit()
5
Sets the default message limit value.
GmCurlConnection::$username
6
GmCurlConnection::$password
6
GmCurlConnection
6
This class creates and populates curl connection.
GmAtom::sortBy()
6
Sorts the message array by the speicified property.
gmatom.php
2
GmAtom library file.
R
README
21
receive_many_specific.php
17
Receive specific number of new messages from Gmail Inbox.
receive_default_label.php
16
Receive default number of new messages from label 'mylabel'.
receive_all_inbox.php
15
Receive all mail from Gmail Inbox example.
Generated by phpDocumentor v1.3.1 http://www.phpdoc.org - http://www.sourceforge.net/projects/phpdocu