Class Zend_Mail_Protocol_Imap

Description

Located in /Mail/Protocol/Imap.php (line 30)


	
			
Variable Summary
 resource|null $_socket
Method Summary
 Zend_Mail_Protocol_Imap __construct ([string $host = ''], [int|null $port = null], [bool $ssl = false])
 void __destruct ()
 bool append (string $folder, string $message, [array $flags = null], [string $date = null])
 array capability ()
 string connect (string $host, [int|null $port = null], [string|bool $ssl = false])
 bool copy (string $folder,  $from, [int|null $to = null])
 bool create (string $folder)
 bool delete (string $folder)
 string escapeList (array $list)
 string|array escapeString (string|array $string)
 bool|array examine ([string $box = 'INBOX'])
 bool|array examineOrSelect ([string $command = 'EXAMINE'], [string $box = 'INBOX'])
 bool expunge ()
 string|array fetch (string|array $items, int $from, [int|null $to = null])
 array listMailbox ([string $reference = ''], [string $mailbox = '*'])
 bool login (string $user, string $password)
 bool logout ()
 bool noop ()
 bool readLine ([ &$tokens = array()], [string $wantedTag = '*'], [bool $dontParse = false], array|string $tokens)
 null|bool|array readResponse (string $tag, [bool $dontParse = false], string|array $filter)
 bool rename (string $old, string $new)
 mixed requestAndResponse (string $command, [array $tokens = array()], [bool $dontParse = false])
 bool|array select ([string $box = 'INBOX'])
 null sendRequest (string $command, [array $tokens = array()], [ &$tag = null], string $tag)
 bool|array store ( $flags, int $from, [int|null $to = null], [string|null $mode = null], [bool $silent = true])
 bool _assumedNextLine (string $start)
 array _decodeLine (string $line)
 string _nextLine ()
 string _nextTaggedLine ( &$tag, string $tag)
Variables
resource|null $_socket (line 36)

socket to imap server

  • access: protected
int $_tagCount = 0 (line 42)

counter for request tag

  • access: protected
Methods
Constructor __construct (line 53)

Public constructor

  • throws: Zend_Mail_Protocol_Exception
Zend_Mail_Protocol_Imap __construct ([string $host = ''], [int|null $port = null], [bool $ssl = false])
  • string $host: hostname of 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
Destructor __destruct (line 63)

Public destructor

  • access: public
void __destruct ()
append (line 681)

append a new message to given folder

  • return: success
  • throws: Zend_Mail_Protocol_Exception
  • access: public
bool append (string $folder, string $message, [array $flags = null], [string $date = null])
  • string $folder: name of target folder
  • string $message: full message content
  • array $flags: flags for new message
  • string $date: date for new message
capability (line 438)

Get capabilities from IMAP server

  • return: list of capabilities
  • throws: Zend_Mail_Protocol_Exception
  • access: public
array capability ()
connect (line 77)

Open connection to POP3 server

  • return: welcome message
  • throws: Zend_Mail_Protocol_Exception
  • access: public
string connect (string $host, [int|null $port = null], [string|bool $ssl = false])
  • string $host: hostname of IP address of POP3 server
  • int|null $port: of IMAP server, default is 143 (993 for ssl)
  • string|bool $ssl: use 'SSL', 'TLS' or false
copy (line 705)

copy message set from current folder to other folder

  • return: success
  • access: public
bool copy (string $folder,  $from, [int|null $to = null])
  • 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
  • $from
create (line 721)

create a new folder (and parent folders if needed)

  • return: success
  • access: public
bool create (string $folder)
  • string $folder: folder name
delete (line 744)

remove a folder

  • return: success
  • access: public
bool delete (string $folder)
  • string $folder: folder name
escapeList (line 384)

escape a list with literals or lists

  • return: escaped list for imap
  • access: public
string escapeList (array $list)
  • array $list: list with literals or lists as PHP array
escapeString (line 362)

escape one or more literals i.e. for sendRequest

  • return: escape literals, literals with newline ar returned as array('{size}', 'string');
  • access: public
string|array escapeString (string|array $string)
  • string|array $string: the literal/-s
examine (line 512)

examine folder

  • return: see examineOrselect()
  • throws: Zend_Mail_Protocol_Exception
  • access: public
bool|array examine ([string $box = 'INBOX'])
  • string $box: examine this folder
examineOrSelect (line 463)

Examine and select have the same response. The common code for both is in this method

  • return: false if error, array with returned information otherwise (flags, exists, recent, uidvalidity)
  • throws: Zend_Mail_Protocol_Exception
  • access: public
bool|array examineOrSelect ([string $command = 'EXAMINE'], [string $box = 'INBOX'])
  • string $command: can be 'EXAMINE' or 'SELECT' and this is used as command
  • string $box: which folder to change to or examine
expunge (line 754)

permanently remove messages

  • return: success
  • access: public
bool expunge ()
fetch (line 531)

fetch one or more items of one or more messages

  • return: 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))
  • throws: Zend_Mail_Protocol_Exception
  • access: public
string|array fetch (string|array $items, int $from, [int|null $to = null])
  • 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
listMailbox (line 607)

get mailbox list

this method can't be named after the IMAP command 'LIST', as list is a reserved keyword

  • return: mailboxes that matched $mailbox as array(globalName => array('delim' => .., 'flags' => ..))
  • throws: Zend_Mail_Protocol_Exception
  • access: public
array listMailbox ([string $reference = ''], [string $mailbox = '*'])
  • string $reference: mailbox reference for list
  • string $mailbox: mailbox name match with wildcards
login (line 406)

Login to IMAP server.

  • return: success
  • throws: Zend_Mail_Protocol_Exception
  • access: public
bool login (string $user, string $password)
  • string $user: username
  • string $password: password
logout (line 416)

logout of imap server

  • return: success
  • access: public
bool logout ()
noop (line 765)

send noop

  • return: success
  • access: public
bool noop ()
readLine (line 257)

read a response "line" (could also be more than one real line if response has {..}<NL>) and do a simple decode

  • return: if returned tag matches wanted tag
  • throws: Zend_Mail_Protocol_Exception
  • access: public
bool readLine ([ &$tokens = array()], [string $wantedTag = '*'], [bool $dontParse = false], array|string $tokens)
  • 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
  • &$tokens
readResponse (line 281)

read all lines of response until given tag is found (last line of response)

  • return: tokens if success, false if error, null if bad request
  • throws: Zend_Mail_Protocol_Exception
  • access: public
null|bool|array readResponse (string $tag, [bool $dontParse = false], string|array $filter)
  • 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
rename (line 733)

rename an existing folder

  • return: success
  • access: public
bool rename (string $old, string $new)
  • string $old: old name
  • string $new: new name
requestAndResponse (line 347)

send a request and get response at once

  • return: response as in readResponse()
  • throws: Zend_Mail_Protocol_Exception
  • access: public
mixed requestAndResponse (string $command, [array $tokens = array()], [bool $dontParse = false])
  • string $command: command as in sendRequest()
  • array $tokens: parameters as in sendRequest()
  • bool $dontParse: if true unparsed lines are returned instead of tokens
select (line 500)

change folder

  • return: see examineOrselect()
  • throws: Zend_Mail_Protocol_Exception
  • access: public
bool|array select ([string $box = 'INBOX'])
  • string $box: change to this folder
sendRequest (line 310)

send a request

  • throws: Zend_Mail_Protocol_Exception
  • access: public
null sendRequest (string $command, [array $tokens = array()], [ &$tag = null], string $tag)
  • string $command: your request command
  • array $tokens: additional parameters to command, use escapeString() to prepare
  • string $tag: provide a tag otherwise an autogenerated is returned
  • &$tag
store (line 637)

set flags

  • return: new flags if $silent is false, else true or false depending on success
  • throws: Zend_Mail_Protocol_Exception
  • access: public
bool|array store ( $flags, int $from, [int|null $to = null], [string|null $mode = null], [bool $silent = true])
  • 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
_assumedNextLine (line 129)

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.

  • return: line starts with $start
  • throws: Zend_Mail_Protocol_Exception
  • access: protected
bool _assumedNextLine (string $start)
  • string $start: the first bytes we assume to be in the next line
_decodeLine (line 159)

split a given line in tokens. a token is literal of any form or a list

  • return: tokens, literals are returned as string, lists as array
  • throws: Zend_Mail_Protocol_Exception
  • access: protected
array _decodeLine (string $line)
  • string $line: line to decode
_nextLine (line 111)

get the next line from socket with error checking, but nothing else

  • return: next line
  • throws: Zend_Mail_Protocol_Exception
  • access: protected
string _nextLine ()
_nextTaggedLine (line 142)

get next line and split the tag. that's the normal case for a response line

  • return: next line
  • throws: Zend_Mail_Protocol_Exception
  • access: protected
string _nextTaggedLine ( &$tag, string $tag)
  • string $tag: tag of line is returned by reference
  • &$tag

Documentation generated on Sun, 27 May 2007 23:24:53 -0700 by phpDocumentor 1.3.2