PHP Class IMP_Api, horde

This file defines IMP's external API interface. Other applications can interact with IMP through this API.
Author: Michael Slusarz ([email protected])
Inheritance: extends Horde_Registry_Api
Show file Open project: horde/horde

Protected Properties

Property Type Description
$_noPerms array The listing of API calls that do not require permissions checking.

Public Methods

Method Description
addFlags ( array $flags ) Ensures a list of user-defined IMAP flag(s) for the current user exist.
batchCompose ( string | array $args = [], array $extra = [] ) : array Return a list of compose window links.
compose ( string | array $args = [], array $extra = [] ) : Horde_Url Returns a compose window link.
copyMessages ( string $mailbox, array $indices, string $target ) : boolean Copies messages to a mailbox.
createMailbox ( string $mbox, array $options = [] ) : Horde_Imap_Client_Mailbox Creates a new mailbox.
deleteMessages ( string $mailbox, array $indices ) : integer | boolean Deletes messages from a mailbox.
favouriteRecipients ( integer $limit, array $filter = ['new', 'forward', 'reply', 'redirect'] ) : array Returns the list of favorite recipients.
flagList ( string $mailbox = null ) : array Return the list of user-settable IMAP flags.
flagMessages ( string $mailbox, array $indices, array $flags, boolean $set ) : boolean Flag messages.
getMaillog ( string $mid ) : Horde_History_Log Obtain the Maillog for a given message.
getMaillogChanges ( integer $ts ) : array Returns a list of Message-IDs that have been added to the Maillog since the specified timestamp.
getSpecialMailboxes ( ) Return the list of special mailboxes.
imapOb ( ) : Horde_Imap_Client_Base Returns the Horde_Imap_Client object created using the IMP credentials.
logMaillog ( string $action, string $mid, string $data = null ) Log an entry in the Maillog.
logRecipient ( $reason, string | array $recipients, string $message_id, boolean $success = true ) Log an entry to the IMP_Sentmail system.
mailboxList ( array $opts = [] ) : array Returns the list of mailboxes.
mdnSend ( Horde_Mime_Headers $headers, $mailbox, $uid ) : boolean Check if we need to send a MDN, and send if needed/able. Will only send MDN if the request does NOT need to be confirmed by the user.
moveMessages ( string $mailbox, array $indices, string $target ) : boolean Moves messages to a mailbox.
searchMailbox ( string $mailbox, Horde_Imap_Client_Search_Query $query ) : array Perform a search query on the remote IMAP server.
server ( ) : mixed Returns information on the currently logged on IMAP server.

Method Details

addFlags() public method

Silently ignores any flags that are already defined.
public addFlags ( array $flags )
$flags array An array of user-defined flag names.

batchCompose() public method

Return a list of compose window links.
public batchCompose ( string | array $args = [], array $extra = [] ) : array
$args string | array List of arguments to pass to compose page. If this is passed in as a string, it will be parsed as a toaddress?subject=foo&cc=ccaddress (mailto-style) string.
$extra array List of hashes of extra, non-standard arguments to pass to compose page.
return array The list of Horde_Url objects with links to the message composition screen.

compose() public method

Returns a compose window link.
public compose ( string | array $args = [], array $extra = [] ) : Horde_Url
$args string | array List of arguments to pass to compose page. If this is passed in as a string, it will be parsed as a toaddress?subject=foo&cc=ccaddress (mailto-style) string.
$extra array Hash of extra, non-standard arguments to pass to compose page.
return Horde_Url The link to the message composition screen.

copyMessages() public method

Copies messages to a mailbox.
public copyMessages ( string $mailbox, array $indices, string $target ) : boolean
$mailbox string The name of the source mailbox (UTF-8).
$indices array The list of UIDs to copy.
$target string The name of the target mailbox (UTF-8).
return boolean True if successful, false if not.

createMailbox() public method

Creates a new mailbox.
public createMailbox ( string $mbox, array $options = [] ) : Horde_Imap_Client_Mailbox
$mbox string The name of the mailbox to create (UTF-8).
$options array Additional options: - full: (boolean) If true, $mbox is a full mailbox name. If false, $mbox will be created in the default namespace. DEFAULT: false
return Horde_Imap_Client_Mailbox The mailbox name created or false on failure.

deleteMessages() public method

Deletes messages from a mailbox.
public deleteMessages ( string $mailbox, array $indices ) : integer | boolean
$mailbox string The name of the mailbox (UTF-8).
$indices array The list of UIDs to delete.
return integer | boolean The number of messages deleted if successful, false if not.

favouriteRecipients() public method

Returns the list of favorite recipients.
public favouriteRecipients ( integer $limit, array $filter = ['new', 'forward', 'reply', 'redirect'] ) : array
$limit integer Return this number of recipients.
$filter array A list of messages types that should be returned. Valid types: 'forward', 'mdn', 'new', 'reply', and 'redirect'. A value of null returns all message types.
return array A list with the $limit most favourite recipients.

flagList() public method

Return the list of user-settable IMAP flags.
public flagList ( string $mailbox = null ) : array
$mailbox string If set, returns the list of flags filtered by what the mailbox allows (UTF-8).
return array A list of IMP_Flag_Base objects.

flagMessages() public method

Flag messages.
public flagMessages ( string $mailbox, array $indices, array $flags, boolean $set ) : boolean
$mailbox string The name of the source mailbox (UTF-8).
$indices array The list of UIDs to flag.
$flags array The flags to set.
$set boolean True to set flags, false to clear flags.
return boolean True if successful, false if not.

getMaillog() public method

Obtain the Maillog for a given message.
public getMaillog ( string $mid ) : Horde_History_Log
$mid string The Message-ID to obtain the log for.
return Horde_History_Log The log object.

getMaillogChanges() public method

Returns a list of Message-IDs that have been added to the Maillog since the specified timestamp.
public getMaillogChanges ( integer $ts ) : array
$ts integer The timestamp to start searching from. Only entries after this timestamp will be returned.
return array An array of Message-IDs that have been changed since $ts.

getSpecialMailboxes() public method

Return the list of special mailboxes.
public getSpecialMailboxes ( )

imapOb() public method

Returns the Horde_Imap_Client object created using the IMP credentials.
public imapOb ( ) : Horde_Imap_Client_Base
return Horde_Imap_Client_Base The imap object.

logMaillog() public method

Log an entry in the Maillog.
public logMaillog ( string $action, string $mid, string $data = null )
$action string The action to log.
$mid string The Message-ID.
$data string Additional data.

logRecipient() public method

Log an entry to the IMP_Sentmail system.
public logRecipient ( $reason, string | array $recipients, string $message_id, boolean $success = true )
$recipients string | array The message recipients.
$message_id string The Message-ID.
$success boolean Was the message successfully sent?

mailboxList() public method

Returns the list of mailboxes.
public mailboxList ( array $opts = [] ) : array
$opts array Additional options:
  - unsub: (boolean)  If true, return unsubscribed mailboxes.
  - reload: (boolean) If true, force reloading the folder tree from
                      the IMAP server. DEFAULT: false
return array The list of IMAP mailboxes. A list of arrays with the following keys:
  - d: (string) The namespace delimiter.
  - label: (string) Human readable label (UTF-8).
  - level: (integer) The child level of this element.
  - ob: (Horde_Imap_Client_Mailbox) A mailbox object.
  - subscribed: (boolean) True if mailbox is subscribed.

mdnSend() public method

Check if we need to send a MDN, and send if needed/able. Will only send MDN if the request does NOT need to be confirmed by the user.
public mdnSend ( Horde_Mime_Headers $headers, $mailbox, $uid ) : boolean
$headers Horde_Mime_Headers The headers of the message.
return boolean True if the MDN request was able to be sent.

moveMessages() public method

Moves messages to a mailbox.
public moveMessages ( string $mailbox, array $indices, string $target ) : boolean
$mailbox string The name of the source mailbox (UTF-8).
$indices array The list of UIDs to move.
$target string The name of the target mailbox (UTF-8).
return boolean True if successful, false if not.

searchMailbox() public method

Perform a search query on the remote IMAP server.
public searchMailbox ( string $mailbox, Horde_Imap_Client_Search_Query $query ) : array
$mailbox string The name of the source mailbox (UTF-8).
$query Horde_Imap_Client_Search_Query The query object.
return array The search results (UID list).

server() public method

Returns information on the currently logged on IMAP server.
public server ( ) : mixed
return mixed An array with the following entries: - hostspec: (string) The server hostname. - port: (integer) The server port. - protocol: (string) Either 'imap' or 'pop'. - secure: (string) Either 'none', 'ssl', or 'tls'.

Property Details

$_noPerms protected property

The listing of API calls that do not require permissions checking.
protected array $_noPerms
return array