Public Member Functions |
| __construct ($host= '', $port=null, $ssl=false) |
| __destruct () |
| connect ($host, $port=null, $ssl=false) |
| readLine (&$tokens=array(), $wantedTag= '*', $dontParse=false) |
| readResponse ($tag, $dontParse=false) |
| sendRequest ($command, $tokens=array(), &$tag=null) |
| requestAndResponse ($command, $tokens=array(), $dontParse=false) |
| escapeString ($string) |
| escapeList ($list) |
| login ($user, $password) |
| logout () |
| capability () |
| examineOrSelect ($command= 'EXAMINE', $box= 'INBOX') |
| select ($box= 'INBOX') |
| examine ($box= 'INBOX') |
| fetch ($items, $from, $to=null) |
| listMailbox ($reference= '', $mailbox= '*') |
| store (array $flags, $from, $to=null, $mode=null, $silent=true) |
| append ($folder, $message, $flags=null, $date=null) |
| copy ($folder, $from, $to=null) |
| create ($folder) |
| rename ($old, $new) |
| delete ($folder) |
| expunge () |
| noop () |
| search (array $params) |
Data Fields |
const | TIMEOUT_CONNECTION = 30 |
Protected Member Functions |
| _nextLine () |
| _assumedNextLine ($start) |
| _nextTaggedLine (&$tag) |
| _decodeLine ($line) |
Protected Attributes |
| $_socket |
| $_tagCount = 0 |
Detailed Description
Definition at line 31 of file Imap.php.
Constructor & Destructor Documentation
__construct |
( |
$ |
host = '' , |
|
|
$ |
port = null , |
|
|
$ |
ssl = false |
|
) |
| |
Public constructor
- Parameters:
-
string | $host | hostname or IP address of IMAP server, if given connect() is called |
int | null | $port | port of IMAP server, null for default (143 or 993 for ssl) |
bool | $ssl | use ssl? 'SSL', 'TLS' or false |
- Exceptions:
-
Definition at line 58 of file Imap.php.
Public destructor
Definition at line 68 of file Imap.php.
Member Function Documentation
_assumedNextLine |
( |
$ |
start ) |
[protected] |
get next line and assume it starts with $start. some requests give a simple feedback so we can quickly check if we can go on.
- Parameters:
-
string | $start | the first bytes we assume to be in the next line |
- Returns:
- bool line starts with $start
- Exceptions:
-
Definition at line 153 of file Imap.php.
_decodeLine |
( |
$ |
line ) |
[protected] |
split a given line in tokens. a token is literal of any form or a list
- Parameters:
-
string | $line | line to decode |
- Returns:
- array tokens, literals are returned as string, lists as array
- Exceptions:
-
Definition at line 183 of file Imap.php.
_nextLine |
( |
) |
[protected] |
_nextTaggedLine |
( |
&$ |
tag ) |
[protected] |
get next line and split the tag. that's the normal case for a response line
- Parameters:
-
string | $tag | tag of line is returned by reference |
- Returns:
- string next line
- Exceptions:
-
Definition at line 166 of file Imap.php.
append |
( |
$ |
folder, |
|
|
$ |
message, |
|
|
$ |
flags = null , |
|
|
$ |
date = null |
|
) |
| |
append a new message to given folder
- Parameters:
-
string | $folder | name of target folder |
string | $message | full message content |
array | $flags | flags for new message |
string | $date | date for new message |
- Returns:
- bool success
- Exceptions:
-
Definition at line 723 of file Imap.php.
Get capabilities from IMAP server
- Returns:
- array list of capabilities
- Exceptions:
-
Definition at line 476 of file Imap.php.
connect |
( |
$ |
host, |
|
|
$ |
port = null , |
|
|
$ |
ssl = false |
|
) |
| |
copy |
( |
$ |
folder, |
|
|
$ |
from, |
|
|
$ |
to = null |
|
) |
| |
copy message set from current folder to other folder
- Parameters:
-
string | $folder | destination folder |
int | null | $to | if null only one message ($from) is fetched, else it's the last message, INF means last message avaible |
- Returns:
- bool success
- Exceptions:
-
Definition at line 747 of file Imap.php.
create a new folder (and parent folders if needed)
- Parameters:
-
- Returns:
- bool success
Definition at line 763 of file Imap.php.
remove a folder
- Parameters:
-
- Returns:
- bool success
Definition at line 786 of file Imap.php.
escape a list with literals or lists
- Parameters:
-
array | $list | list with literals or lists as PHP array |
- Returns:
- string escaped list for imap
Definition at line 422 of file Imap.php.
escapeString |
( |
$ |
string ) |
|
escape one or more literals i.e. for sendRequest
- Parameters:
-
string | array | $string | the literal/-s |
- Returns:
- string|array escape literals, literals with newline ar returned as array('{size}', 'string');
Definition at line 400 of file Imap.php.
examine |
( |
$ |
box = 'INBOX' ) |
|
examine folder
- Parameters:
-
string | $box | examine this folder |
- Returns:
- bool|array see examineOrselect()
- Exceptions:
-
Definition at line 550 of file Imap.php.
examineOrSelect |
( |
$ |
command = 'EXAMINE' , |
|
|
$ |
box = 'INBOX' |
|
) |
| |
Examine and select have the same response. The common code for both is in this method
- Parameters:
-
string | $command | can be 'EXAMINE' or 'SELECT' and this is used as command |
string | $box | which folder to change to or examine |
- Returns:
- bool|array false if error, array with returned information otherwise (flags, exists, recent, uidvalidity)
- Exceptions:
-
Definition at line 501 of file Imap.php.
permanently remove messages
- Returns:
- bool success
Definition at line 796 of file Imap.php.
fetch |
( |
$ |
items, |
|
|
$ |
from, |
|
|
$ |
to = null |
|
) |
| |
fetch one or more items of one or more messages
- Parameters:
-
string | array | $items | items to fetch from message(s) as string (if only one item) or array of strings |
int | $from | message for items or start message if $to !== null |
int | null | $to | if null only one message ($from) is fetched, else it's the last message, INF means last message avaible |
- Returns:
- string|array if only one item of one message is fetched it's returned as string if items of one message are fetched it's returned as (name => value) if one items of messages are fetched it's returned as (msgno => value) if items of messages are fetchted it's returned as (msgno => (name => value))
- Exceptions:
-
- See also:
- Zend_Mail_Protocol_Exception
Definition at line 569 of file Imap.php.
listMailbox |
( |
$ |
reference = '' , |
|
|
$ |
mailbox = '*' |
|
) |
| |
get mailbox list
this method can't be named after the IMAP command 'LIST', as list is a reserved keyword
- Parameters:
-
string | $reference | mailbox reference for list |
string | $mailbox | mailbox name match with wildcards |
- Returns:
- array mailboxes that matched $mailbox as array(globalName => array('delim' => .., 'flags' => ..))
- Exceptions:
-
Definition at line 649 of file Imap.php.
login |
( |
$ |
user, |
|
|
$ |
password |
|
) |
| |
Login to IMAP server.
- Parameters:
-
string | $user | username |
string | $password | password |
- Returns:
- bool success
- Exceptions:
-
Definition at line 444 of file Imap.php.
logout of imap server
- Returns:
- bool success
Definition at line 454 of file Imap.php.
send noop
- Returns:
- bool success
Definition at line 807 of file Imap.php.
readLine |
( |
&$ |
tokens = array() , |
|
|
$ |
wantedTag = '*' , |
|
|
$ |
dontParse = false |
|
) |
| |
read a response "line" (could also be more than one real line if response has {..}<NL>) and do a simple decode
- Parameters:
-
array | string | $tokens | decoded tokens are returned by reference, if $dontParse is true the unparsed line is returned here |
string | $wantedTag | check for this tag for response code. Default '*' is continuation tag. |
bool | $dontParse | if true only the unparsed line is returned $tokens |
- Returns:
- bool if returned tag matches wanted tag
- Exceptions:
-
Definition at line 283 of file Imap.php.
readResponse |
( |
$ |
tag, |
|
|
$ |
dontParse = false |
|
) |
| |
read all lines of response until given tag is found (last line of response)
- Parameters:
-
string | $tag | the tag of your request |
string | array | $filter | you can filter the response so you get only the given response lines |
bool | $dontParse | if true every line is returned unparsed instead of the decoded tokens |
- Returns:
- null|bool|array tokens if success, false if error, null if bad request
- Exceptions:
-
Definition at line 307 of file Imap.php.
rename an existing folder
- Parameters:
-
string | $old | old name |
string | $new | new name |
- Returns:
- bool success
Definition at line 775 of file Imap.php.
requestAndResponse |
( |
$ |
command, |
|
|
$ |
tokens = array() , |
|
|
$ |
dontParse = false |
|
) |
| |
send a request and get response at once
- Parameters:
-
string | $command | command as in sendRequest() |
array | $tokens | parameters as in sendRequest() |
bool | $dontParse | if true unparsed lines are returned instead of tokens |
- Returns:
- mixed response as in readResponse()
- Exceptions:
-
Definition at line 385 of file Imap.php.
search |
( |
array $ |
params ) |
|
do a search request
This method is currently marked as internal as the API might change and is not safe if you don't take precautions.
Definition at line 822 of file Imap.php.
select |
( |
$ |
box = 'INBOX' ) |
|
change folder
- Parameters:
-
string | $box | change to this folder |
- Returns:
- bool|array see examineOrselect()
- Exceptions:
-
Definition at line 538 of file Imap.php.
sendRequest |
( |
$ |
command, |
|
|
$ |
tokens = array() , |
|
|
&$ |
tag = null |
|
) |
| |
store |
( |
array $ |
flags, |
|
|
$ |
from, |
|
|
$ |
to = null , |
|
|
$ |
mode = null , |
|
|
$ |
silent = true |
|
) |
| |
set flags
- Parameters:
-
array | $flags | flags to set, add or remove - see $mode |
int | $from | message for items or start message if $to !== null |
int | null | $to | if null only one message ($from) is fetched, else it's the last message, INF means last message avaible |
string | null | $mode | '+' to add flags, '-' to remove flags, everything else sets the flags as given |
bool | $silent | if false the return values are the new flags for the wanted messages |
- Returns:
- bool|array new flags if $silent is false, else true or false depending on success
- Exceptions:
-
Definition at line 679 of file Imap.php.
Field Documentation
Default timeout in seconds for initiating session
Definition at line 36 of file Imap.php.
The documentation for this class was generated from the following file:
- E:/E/GEAMP/www/openbiz/openbiz/others/Zend/Mail/Protocol/Imap.php