ezcMailImapTransport::capability PHP 메소드

capability() 공개 메소드

The returned array will be something like this: array( 'IMAP4rev1', 'SASL-IR SORT', 'THREAD=REFERENCES', 'MULTIAPPEND', 'UNSELECT', 'LITERAL+', 'IDLE', 'CHILDREN', 'NAMESPACE', 'LOGIN-REFERRALS' ); Before calling this method, a connection to the IMAP server must be established.
public capability ( ) : array(string)
리턴 array(string)
    public function capability()
    {
        if ($this->state != self::STATE_NOT_AUTHENTICATED && $this->state != self::STATE_AUTHENTICATED && $this->state != self::STATE_SELECTED && $this->state != self::STATE_SELECTED_READONLY) {
            throw new ezcMailTransportException("Trying to request capability when not connected to server.");
        }
        $tag = $this->getNextTag();
        $this->connection->sendData("{$tag} CAPABILITY");
        $response = $this->connection->getLine();
        while ($this->responseType($response) != self::RESPONSE_UNTAGGED && strpos($response, '* CAPABILITY ') === false) {
            $response = $this->connection->getLine();
        }
        $result = trim($response);
        $response = trim($this->getResponse($tag));
        if ($this->responseType($response) != self::RESPONSE_OK) {
            throw new ezcMailTransportException("The IMAP server responded negative to the CAPABILITY command: {$response}.");
        }
        return explode(' ', str_replace('* CAPABILITY ', '', $result));
    }

Usage Example

예제 #1
0
<?php

require_once 'tutorial_autoload.php';
// Create a new IMAP transport object by specifying the server name
$imap = new ezcMailImapTransport("imap.example.com");
// Authenticate to the IMAP server
$imap->authenticate("user", "password");
// Select the Inbox mailbox
$imap->selectMailbox('Inbox');
// List the capabilities of the IMAP server
$capabilities = $imap->capability();
// List existing mailboxes
$mailboxes = $imap->listMailboxes("", "*");
// Fetch the hierarchy delimiter character (usually "/")
$delimiter = $imap->getHierarchyDelimiter();
// Create a new mailbox
$imap->createMailbox("Reports 2006");
// Delete a mailbox
$imap->deleteMailbox("Reports 2005");
// Rename a mailbox
$imap->renameMailbox("Reports 2006", "Reports");
// Copy messages from the selected mailbox (here: Inbox) to another mailbox
$imap->copyMessages("1,2,4", "Reports");
// Set a flag to messages
// See the function description for a list of supported flags
$imap->setFlag("1,2,4", "DELETED");
// Clears a flag from messages
// See the function description for a list of supported flags
$imap->clearFlag("1,2,4", "SEEN");
// Append a message to a mailbox. $mail must contain the mail as text
// Use this with a "Sent" or "Drafts" mailbox
All Usage Examples Of ezcMailImapTransport::capability