Class IMP_Message
The IMP_Message:: class contains all functions related to handling messages
within IMP. Actions such as moving, copying, and deleting messages are
handled in here so that code need not be repeated between mailbox, message,
and other pages.
Copyright 2000-2001 Chris Hyde chris@jeks.net
Copyright 2000-2012 Horde LLC (http://www.horde.org/)
See the enclosed file COPYING for license information (GPL). If you
did not receive this file, see http://www.horde.org/licenses/gpl.
Methods summary
public
boolean
|
#
copy( string $targetMbox, string $action, IMP_Indices $indices, array $opts = array() )
Copies or moves a list of messages to a new mailbox.
Handles search and Trash mailboxes.
Also handles moves to the tasklist and/or notepad applications.
Copies or moves a list of messages to a new mailbox.
Handles search and Trash mailboxes.
Also handles moves to the tasklist and/or notepad applications.
Parameters
- $targetMbox
- <p>The mailbox to move/copy messages to
(UTF7-IMAP).</p>
- $action
- Either 'copy' or 'move'.
- $indices
- An indices object.
- $opts
- <p>Additional options:
- create: (boolean) Should the target mailbox be created?
DEFAULT: false
- mailboxob: (IMP_Mailbox_List) Update this mailbox object.
DEFAULT: No update.</p>
Returns
boolean True if successful, false if not.
|
public
integer|boolean
|
#
delete( IMP_Indices $indices, array $opts = array() )
Deletes a list of messages taking into account whether or not a
Trash folder is being used.
Handles search and Trash mailboxes.
Deletes a list of messages taking into account whether or not a
Trash folder is being used.
Handles search and Trash mailboxes.
Parameters
- $indices
- An indices object.
- $opts
- <p>Additional options:
- keeplog: (boolean) Should any history information of the message be
kept?
- mailboxob: (IMP_Mailbox_List) Update this mailbox object.
DEFAULT: No update.
- nuke: (boolean) Override user preferences and nuke (i.e.
permanently delete) the messages instead?</p>
Returns
integer|boolean The number of messages deleted if successful,
false if not.
|
public
boolean
|
#
undelete( IMP_Indices $indices )
Undeletes a list of messages.
Handles search mailboxes.
This function works with IMAP only, not POP3.
Undeletes a list of messages.
Handles search mailboxes.
This function works with IMAP only, not POP3.
Parameters
- $indices
- An indices object.
Returns
boolean True if successful, false if not.
|
public
IMP_Indices
|
#
stripPart( IMP_Indices $indices, string $partid = null, array $opts = array() )
Strips one or all MIME parts out of a message.
Handles search mailboxes.
Strips one or all MIME parts out of a message.
Handles search mailboxes.
Parameters
- $indices
- An indices object.
- $partid
- <p>The MIME ID of the part to strip. All
parts are stripped if null.</p>
- $opts
- <p>Additional options:
- mailboxob: (IMP_Mailbox_List) Update this mailbox object.
DEFAULT: No update.</p>
Returns
Throws
|
public
boolean
|
#
flag( array $flags, IMP_Indices $indices, boolean $action = true )
Sets or clears a given flag for a list of messages.
Handles search mailboxes.
This function works with IMAP only, not POP3.
Sets or clears a given flag for a list of messages.
Handles search mailboxes.
This function works with IMAP only, not POP3.
Parameters
- $flags
- The IMAP flag(s) to set or clear.
- $indices
- An indices object.
- $action
- <p>If true, set the flag(s), otherwise clear
the flag(s).</p>
Returns
boolean True if successful, false if not.
|
public
boolean
|
#
flagAllInMailbox( array $flags, array $mboxes, boolean $action = true )
Adds or removes flag(s) for all messages in a list of mailboxes.
This function works with IMAP only, not POP3.
Adds or removes flag(s) for all messages in a list of mailboxes.
This function works with IMAP only, not POP3.
Parameters
- $flags
- The IMAP flag(s) to add or remove.
- $mboxes
- The list of mailboxes to flag.
- $action
- <p>If true, add the flag(s), otherwise, remove the
flag(s).</p>
Returns
boolean True if successful, false if not.
|
public
IMP_Indices
|
#
expungeMailbox( array $mbox_list, array $opts = array() )
Expunges all deleted messages from the list of mailboxes.
Expunges all deleted messages from the list of mailboxes.
Parameters
- $mbox_list
- <p>The list of mailboxes to empty as keys; an
optional array of indices to delete as values.
If the value is not an array, all messages
flagged as deleted in the mailbox will be
deleted.</p>
- $opts
- <p>Additional options:
- list: (boolean) Return a list of messages expunged.
DEFAULT: false
- mailboxob: (IMP_Mailbox_List) Update this mailbox object.
DEFAULT: No update.</p>
Returns
IMP_Indices
If 'list' option is true, an indices object
containing the messages that have been expunged.
|
public
|
#
emptyMailbox( array $mbox_list )
Empties an entire mailbox.
Empties an entire mailbox.
Parameters
- $mbox_list
- The list of mailboxes to empty.
|
public
mixed
|
#
sizeMailbox( IMP_Mailbox $mbox, boolean $formatted = true )
Obtains the size of a mailbox.
Obtains the size of a mailbox.
Parameters
- $mbox
- The mailbox to obtain the size of.
- $formatted
- Whether to return a human readable value.
Returns
mixed Either the size of the mailbox (in bytes) or a formatted
string with this information.
|