Imap class that connects to the mailbox and retrieves messages
Use this class to initiate a connection and then retrieve the data needed. Messages can be retrieved based on flags, limits, offsets, and sorted. Not all data is instantly downloaded, just the basic information to speed up usage where needed.
category | |
---|---|
package | Imap |
author | Tim Withers |
copyright | 2012 Tim Withers |
license | PHP License 3.01 |
version | 1.0 |
__construct(array $params)
Params are passed as an array when calling. Possible $params keys are: 'host' 'port' 'ssl' 'folder' 'username' 'password' 'options'
A parameter key not set will use the defaults from the class properties.
array
__destruct()
__get(string $name) : resource
Only function is to return the resource connection when requested rather than using the getConnection() function;
inherited_from | \Imap_Base::__get() |
---|
string
resource
Connection resource. FALSE if $name!='connection'__isset(string $name) : bool
string
bool
__set(string $name, string $value)
string
string
get() : array
array
Messages are Imap_MessagesgetAttachmentType(int $type, string $subtype) : string
Some examples would be: 'application/pdf' 'image/png' 'application/octet-stream'
inherited_from | \Imap_Base::getAttachmentType() |
---|
int
Integer representing 1 of 8 main types
string
Specified subtype
string
limit(int $start, int $count) : \Imap
Emails start with 1, not 0.
int
int
If not set, will return everything after initial email
\Imap
For method chainingpurgeOnExit(bool $bool)
bool
Default is true
sort(string $field, string $dir) : \Imap
Sortable fields are listed in possibleSort().
see | \global\Imap::possibleSort() |
---|
string
string
Like MySQL ('ASC', 'DESC')
\Imap
For method chainingwhere(\type $array) : \Imap
Searchable fields are listed in possibleCriteria(). Array must be structured as below: where(array('subject'=>'My subject*'))
see | \global\Imap::possibleCriteria() |
---|---|
link | 6.4.4 deals with searching |
\type
\Imap
For method chainingdecode(string $string, int $type) : string
Types are declared in numeric format in the headers of each part. Each part has to be decoded for readability.
inherited_from | \Imap_Base::decode() |
---|
string
To be decoded
int
string
doSearch() : array
array
$results Array of message idsdoSort() : array
Does sort and search based on criteria in filter
array
$results Array of message idsgetConnection() : resource
Since connection is static, all subclasses do not need to reconnect and there is no need to pass the resource into the child classes from the main Imap class
inherited_from | \Imap_Base::getConnection() |
---|
resource
ConnectiongetCriteria()
Data is from the filter array and can be set using functions or manually
getLimited(array $results) : array
array
Array of message ids
array
$results Array of message idspossibleCriteria() : array
array
possibleReverseSort() : array
array
possibleSort() : array
array
setConnection(resource $con)
inherited_from | \Imap_Base::setConnection() |
---|
resource
$filter : array
Set to defaults upon __construct()
Holds the variables needed to filter through a result set and return the desired types of messages and in a particular order.
$info : \StdClass
Mailbox info contains information on the number of messages in the folder and the number of unread messages, etc.
$mail : array
$purge : bool
$connection
This is set from the Imap class
static | Connection to Imap server |
---|---|
inherited_from | \Imap_Base::$$connection |
$folder : string
Set in __construct()
$host : string
Set in __construct()
$password : string
Set in __construct()
$port : int
Set in __construct()
$protocol : \type
Set in __construct()
$ssl : bool
Set in __construct()
$username : string
Set in __construct()