Overview

Packages

  • IMP
  • None

Classes

  • IMP
  • IMP_Ajax_Application
  • IMP_Ajax_Imple_ContactAutoCompleter
  • IMP_Ajax_Imple_PassphraseDialog
  • IMP_Ajax_Queue
  • IMP_Api
  • IMP_Auth
  • IMP_Block_Newmail
  • IMP_Block_Summary
  • IMP_Compose
  • IMP_Compose_Exception
  • IMP_Compose_Stationery
  • IMP_Contents
  • IMP_Crypt_Pgp
  • IMP_Crypt_Smime
  • IMP_Dimp
  • IMP_Exception
  • IMP_Factory_AuthImap
  • IMP_Factory_Compose
  • IMP_Factory_Contents
  • IMP_Factory_Flags
  • IMP_Factory_Identity
  • IMP_Factory_Imap
  • IMP_Factory_Imaptree
  • IMP_Factory_Mail
  • IMP_Factory_Mailbox
  • IMP_Factory_MailboxList
  • IMP_Factory_MimeViewer
  • IMP_Factory_Pgp
  • IMP_Factory_Quota
  • IMP_Factory_Search
  • IMP_Factory_Sentmail
  • IMP_Factory_Smime
  • IMP_Filter
  • IMP_Flag_Base
  • IMP_Flag_Imap
  • IMP_Flag_Imap_Answered
  • IMP_Flag_Imap_Deleted
  • IMP_Flag_Imap_Draft
  • IMP_Flag_Imap_Flagged
  • IMP_Flag_Imap_Forwarded
  • IMP_Flag_Imap_Junk
  • IMP_Flag_Imap_NotJunk
  • IMP_Flag_Imap_Seen
  • IMP_Flag_System_Attachment
  • IMP_Flag_System_Encrypted
  • IMP_Flag_System_HighPriority
  • IMP_Flag_System_List
  • IMP_Flag_System_LowPriority
  • IMP_Flag_System_Match_Address
  • IMP_Flag_System_Match_Flag
  • IMP_Flag_System_Match_Header
  • IMP_Flag_System_Personal
  • IMP_Flag_System_Signed
  • IMP_Flag_System_Unseen
  • IMP_Flag_User
  • IMP_Flags
  • IMP_Imap
  • IMP_Imap_Acl
  • IMP_Imap_Exception
  • IMP_Imap_PermanentFlags
  • IMP_Imap_Thread
  • IMP_Imap_Tree
  • IMP_Indices
  • IMP_Indices_Form
  • IMP_LoginTasks_SystemTask_GarbageCollection
  • IMP_LoginTasks_SystemTask_Upgrade
  • IMP_LoginTasks_SystemTask_UpgradeAuth
  • IMP_LoginTasks_Task_Autocreate
  • IMP_LoginTasks_Task_DeleteAttachmentsMonthly
  • IMP_LoginTasks_Task_DeleteSentmailMonthly
  • IMP_LoginTasks_Task_FilterOnLogin
  • IMP_LoginTasks_Task_PurgeSentmail
  • IMP_LoginTasks_Task_PurgeSpam
  • IMP_LoginTasks_Task_PurgeTrash
  • IMP_LoginTasks_Task_RecoverDraft
  • IMP_LoginTasks_Task_RenameSentmailMonthly
  • IMP_Mailbox
  • IMP_Mailbox_List
  • IMP_Mailbox_List_Track
  • IMP_Maillog
  • IMP_Menu_Dimp
  • IMP_Message
  • IMP_Mime_Status
  • IMP_Mime_Viewer_Alternative
  • IMP_Mime_Viewer_Appledouble
  • IMP_Mime_Viewer_Audio
  • IMP_Mime_Viewer_Enriched
  • IMP_Mime_Viewer_Externalbody
  • IMP_Mime_Viewer_Html
  • IMP_Mime_Viewer_Images
  • IMP_Mime_Viewer_Itip
  • IMP_Mime_Viewer_Mdn
  • IMP_Mime_Viewer_Partial
  • IMP_Mime_Viewer_Pdf
  • IMP_Mime_Viewer_Pgp
  • IMP_Mime_Viewer_Plain
  • IMP_Mime_Viewer_Related
  • IMP_Mime_Viewer_Rfc822
  • IMP_Mime_Viewer_Smil
  • IMP_Mime_Viewer_Smime
  • IMP_Mime_Viewer_Status
  • IMP_Mime_Viewer_Vcard
  • IMP_Mime_Viewer_Video
  • IMP_Mime_Viewer_Zip
  • IMP_Notification_Event_Status
  • IMP_Notification_Handler_Decorator_ImapAlerts
  • IMP_Notification_Handler_Decorator_NewmailNotify
  • IMP_Notification_Listener_AjaxStatus
  • Imp_Prefs_Identity
  • IMP_Prefs_Ui
  • IMP_Quota
  • IMP_Quota_Base
  • IMP_Quota_Command
  • IMP_Quota_Hook
  • IMP_Quota_Imap
  • IMP_Quota_Maildir
  • IMP_Quota_Mdaemon
  • IMP_Quota_Mercury32
  • IMP_Quota_Null
  • IMP_Quota_Sql
  • IMP_Search
  • IMP_Search_Element
  • IMP_Search_Element_Attachment
  • IMP_Search_Element_Autogenerated
  • IMP_Search_Element_Bulk
  • IMP_Search_Element_Contacts
  • IMP_Search_Element_Date
  • IMP_Search_Element_Flag
  • IMP_Search_Element_Header
  • IMP_Search_Element_Mailinglist
  • IMP_Search_Element_Or
  • IMP_Search_Element_Personal
  • IMP_Search_Element_Recipient
  • IMP_Search_Element_Size
  • IMP_Search_Element_Text
  • IMP_Search_Element_Within
  • IMP_Search_Filter
  • IMP_Search_Filter_Attachment
  • IMP_Search_Filter_Autogenerated
  • IMP_Search_Filter_Builtin
  • IMP_Search_Filter_Bulk
  • IMP_Search_Filter_Contacts
  • IMP_Search_Filter_Mailinglist
  • IMP_Search_Filter_Personal
  • IMP_Search_Query
  • IMP_Search_Vfolder
  • IMP_Search_Vfolder_Builtin
  • IMP_Search_Vfolder_Vinbox
  • IMP_Search_Vfolder_Vtrash
  • IMP_Sentmail
  • IMP_Sentmail_Base
  • IMP_Sentmail_Null
  • IMP_Sentmail_Sql
  • IMP_Spam
  • IMP_Test
  • IMP_Tree_Flist
  • IMP_Tree_Jquerymobile
  • IMP_Tree_Simplehtml
  • IMP_Ui_Compose
  • IMP_Ui_Editor
  • IMP_Ui_Folder
  • IMP_Ui_Headers
  • IMP_Ui_Imageview
  • IMP_Ui_Mailbox
  • IMP_Ui_Message
  • IMP_Ui_Mimp
  • IMP_Ui_Search
  • IMP_Views_Compose
  • IMP_Views_ListMessages
  • IMP_Views_ShowMessage
  • Overview
  • Package
  • Class
  • Tree

Class IMP_Compose

The IMP_Compose:: class represents an outgoing mail message.

Copyright 2002-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.

IMP_Compose implements ArrayAccess, Countable, Iterator, Serializable
Package: IMP
Category: Horde
License: GPL
Author: Michael Slusarz slusarz@horde.org
Located at Compose.php
Methods summary
public
# __construct( string $cacheid )

Constructor.

Constructor.

Parameters

$cacheid
The cache ID string.
public
# destroy( string $action )

Destroys an IMP_Compose instance.

Destroys an IMP_Compose instance.

Parameters

$action
<p>The action performed to cause the end of this instance. Either 'cancel', 'save_draft', or 'send'.</p>
public mixed
# getMetadata( string $name )

Gets metadata about the current object.

Gets metadata about the current object.

Parameters

$name
The metadata name.

Returns

mixed
The metadata value or null if it doesn't exist.
public string
# saveDraft( array $headers, mixed $message, array $opts = array() )

Saves a message to the draft folder.

Saves a message to the draft folder.

Parameters

$headers
$header List of message headers (UTF-8).
$message
<p>Either the message text (string) or a Horde_Mime_Part object that contains the text to send.</p>
$opts
<p>An array of options w/the following keys: - html: (boolean) Is this an HTML message? - priority: (string) The message priority ('high', 'normal', 'low'). - readreceipt: (boolean) Add return receipt headers?</p>

Returns

string
Notification text on success (not HTML encoded).

Throws

IMP_Compose_Exception
public mixed
# resumeDraft( IMP_Indices $indices, boolean $addheaders = true )

Resumes a previously saved draft message.

Resumes a previously saved draft message.

Parameters

$indices
An indices object.
$addheaders
Populate header entries?

Returns

mixed

An array with the following keys: - header: (array) A list of headers to add to the outgoing message. - identity: (integer) The identity used to create the message. - mode: (string) 'html' or 'text'. - msg: (string) The message text. - priority: (string) The message priority. - readreceipt: (boolean) Add return receipt headers?

Throws

IMP_Compose_Exception
public boolean
# hasDrafts( )

Does this message have any drafts associated with it?

Does this message have any drafts associated with it?

Returns

boolean
True if draft messages exist.
public boolean
# buildAndSendMessage( string $body, array $header, array $opts = array() )

Builds and sends a MIME message.

Builds and sends a MIME message.

Parameters

$body
The message body.
$header
List of message headers.
$opts
An array of options w/the following keys: <ul> <li> encrypt: (integer) A flag whether to encrypt or sign the message. One of: <ul> <li>IMP_Crypt_Pgp::ENCRYPT</li> <li>IMP_Crypt_Pgp::SIGNENC</li> <li>IMP_Crypt_Smime::ENCRYPT</li> <li>IMP_Crypt_Smime::SIGNENC</li> </ul> </li> <li> html: (boolean) Whether this is an HTML message. DEFAULT: false </li> <li> identity: (IMP_Prefs_Identity) If set, checks for proper tie-to addresses. </li> <li> priority: (string) The message priority ('high', 'normal', 'low'). </li> <li> save_sent: (boolean) Save sent mail? </li> <li> sent_folder: (IMP_Mailbox) The sent-mail folder (UTF7-IMAP). </li> <li> save_attachments: (bool) Save attachments with the message? </li> <li> readreceipt: (boolean) Add return receipt headers? </li> <li> useragent: (string) The User-Agent string to use. </li> </ul>

Returns

boolean

Whether the sent message has been saved in the sent-mail folder.

Throws

Horde_Exception
IMP_Compose_Exception
IMP_Exception
public
# sendMessage( array $email, Horde_Mime_Headers $headers, Horde_Mime_Part $message )

Sends a message.

Sends a message.

Parameters

$email
The e-mail list to send to.
$headers
<p>The object holding this message's headers.</p>
$message
<p>The Horde_Mime_Part object that contains the text to send.</p>

Throws

IMP_Compose_Exception
public array
# recipientList( array $hdr )

Cleans up and returns the recipient list. Method designed to parse user entered data; does not encode/validate addresses.

Cleans up and returns the recipient list. Method designed to parse user entered data; does not encode/validate addresses.

Parameters

$hdr
<p>An array of MIME headers. Recipients will be extracted from the 'to', 'cc', and 'bcc' entries.</p>

Returns

array

An array with the following entries: - has_input: (boolean) True if at least one of the headers contains user input. - header: (array) Contains the cleaned up 'to', 'cc', and 'bcc' header strings. - list: (array) Recipient addresses (address objects). - recips: (array) List of recipient addresses (string).

public array
# replyMessage( integer $type, IMP_Contents $contents, string $to = null )

Determines the reply text and headers for a message.

Determines the reply text and headers for a message.

Parameters

$type
The reply type (self::REPLY* constant).
$contents
An IMP_Contents object.
$to
<p>The recipient of the reply. Overrides the automatically determined value.</p>

Returns

array

An array with the following keys: - body: The text of the body part - format: The format of the body message - headers: The headers of the message to use for the reply - identity: The identity to use for the reply based on the original message's addresses. - lang: An array of language code (keys)/language name (values) of the original sender's preferred language(s). - reply_list_id: List ID label. - reply_recip: Number of recipients in reply list. - type: The reply type used (either self::REPLY_ALL, self::REPLY_LIST, or self::REPLY_SENDER).

public array
# replyMessageText( IMP_Contents $contents, array $opts = array() )

Returns the reply text for a message.

Returns the reply text for a message.

Parameters

$contents
An IMP_Contents object.
$opts
<p>Additional options: - format: (string) Force to this format. DEFAULT: Auto-determine.</p>

Returns

array

An array with the following keys: - body: (string) The text of the body part. - charset: (string) The guessed charset to use for the reply. - format: (string) The format of the body message ('html', 'text').

public array
# forwardMessage( integer $type, IMP_Contents $contents, boolean $attach = true )

Determine the text and headers for a forwarded message.

Determine the text and headers for a forwarded message.

Parameters

$type
<p>The forward type (self::FORWARD* constant).</p>
$contents
An IMP_Contents object.
$attach
Attach the forwarded message?

Returns

array
An array with the following keys:
  • body: (string) The text of the body part.
  • format: (string) The format of the body message ('html', 'text').
  • headers: (array) The headers of the message to use for the reply.
  • identity: (mixed) See Imp_Prefs_Identity#getMatchingIdentity().
  • type: (integer) - The forward type used. Either:
    • self::FORWARD_ATTACH
    • self::FORWARD_BODY
    • self::FORWARD_BOTH
public array
# forwardMessageText( IMP_Contents $contents, array $opts = array() )

Returns the forward text for a message.

Returns the forward text for a message.

Parameters

$contents
An IMP_Contents object.
$opts
<p>Additional options: - format: (string) Force to this format. DEFAULT: Auto-determine.</p>

Returns

array

An array with the following keys: - body: (string) The text of the body part. - charset: (string) The guessed charset to use for the forward. - format: (string) The format of the body message ('html', 'text').

public
# redirectMessage( IMP_Indices $indices )

Prepare a redirect message.

Prepare a redirect message.

Parameters

$indices
An indices object.
public array
# sendRedirectMessage( string $to, boolean $log = true )

Send a redirect (a/k/a resent) message. See RFC 5322 [3.6.6].

Send a redirect (a/k/a resent) message. See RFC 5322 [3.6.6].

Parameters

$to
The addresses to redirect to.
$log
<p>Whether to log the resending in the history and sentmail log.</p>

Returns

array

An object with the following properties for each redirected message: - contents: (IMP_Contents) The contents object. - headers: (Horde_Mime_Headers) The header object. - mbox: (IMP_Mailbox) Mailbox of the message. - uid: (string) UID of the message.

Throws

IMP_Compose_Exception
public string
# attachImapMessage( IMP_Indices $indices )

Add mail message(s) from the mail server as a message/rfc822 attachment.

Add mail message(s) from the mail server as a message/rfc822 attachment.

Parameters

$indices
An indices object.

Returns

string
Subject string.

Throws

IMP_Exception
public string
# addUploadAttachment( string $name )

Adds an attachment to a Horde_Mime_Part from an uploaded file.

Adds an attachment to a Horde_Mime_Part from an uploaded file.

Parameters

$name
The input field name from the form.

Returns

string
The filename.

Throws

IMP_Compose_Exception
public
# addMimePartAttachment( Horde_Mime_Part $part )

Adds an attachment to a Horde_Mime_Part from data existing in the part.

Adds an attachment to a Horde_Mime_Part from data existing in the part.

Parameters

$part
<p>The object that contains the attachment data.</p>

Throws

IMP_Compose_Exception
public
# deleteAllAttachments( )

Deletes all attachments.

Deletes all attachments.

public integer
# sizeOfAttachments( )

Returns the size of the attachments in bytes.

Returns the size of the attachments in bytes.

Returns

integer
The size of the attachments (in bytes).
public Horde_Mime_Part
# buildAttachment( integer $id )

Build a single attachment part with its data.

Build a single attachment part with its data.

Parameters

$id
The ID of the part to rebuild.

Returns

Horde_Mime_Part
The Horde_Mime_Part with its contents.
public string
# getCacheId( )

Obtains the cache ID for the session object.

Obtains the cache ID for the session object.

Returns

string
The message cache ID.
public mixed
# additionalAttachmentsAllowed( )

How many more attachments are allowed?

How many more attachments are allowed?

Returns

mixed

Returns true if no attachment limit. Else returns the number of additional attachments allowed.

public integer
# maxAttachmentSize( )

What is the maximum attachment size allowed?

What is the maximum attachment size allowed?

Returns

integer
The maximum attachment size allowed (in bytes).
public Horde_Mime_Part
# linkAttachments( Horde_Mime_Part $part )

Remove all attachments from an email message and replace with urls to downloadable links. Should properly save all attachments to a new folder and remove the Horde_Mime_Parts for the attachments.

Remove all attachments from an email message and replace with urls to downloadable links. Should properly save all attachments to a new folder and remove the Horde_Mime_Parts for the attachments.

Parameters

$part
The body of the message.

Returns

Horde_Mime_Part
Modified MIME part with links to attachments.

Throws

IMP_Compose_Exception
public
# pgpAttachPubkey( boolean $attach )

Attach the user's PGP public key to every message sent by buildAndSendMessage().

Attach the user's PGP public key to every message sent by buildAndSendMessage().

Parameters

$attach
True if public key should be attached.
public
# attachVCard( mixed $name )

Attach the user's vCard to every message sent by buildAndSendMessage().

Attach the user's vCard to every message sent by buildAndSendMessage().

Parameters

$name
<p>The user's name. If false, will not attach vCard to message.</p>

Throws

IMP_Compose_Exception
public
# userLinkAttachments( boolean $attach )

Has user specifically asked attachments to be linked in outgoing messages?

Has user specifically asked attachments to be linked in outgoing messages?

Parameters

$attach
True if attachments should be linked.
public boolean
# addFilesFromUpload( string $field, boolean $notify = false )

Add uploaded files from form data.

Add uploaded files from form data.

Parameters

$field
The field prefix (numbering starts at 1).
$notify
<p>Add a notification message for each successful attachment?</p>

Returns

boolean
Returns false if any file was unsuccessfully added.
public static string
# text2html( string $msg )

Shortcut function to convert text -> HTML for purposes of composition.

Shortcut function to convert text -> HTML for purposes of composition.

Parameters

$msg
The message text.

Returns

string
HTML text.
public
# sessionExpireDraft( Horde_Variables $vars )

Store draft compose data if session expires.

Store draft compose data if session expires.

Parameters

$vars
Object with the form data.
public
# recoverSessionExpireDraft( )

Restore session expiration draft compose data.

Restore session expiration draft compose data.

public mixed
# getContentsOb( )

If this object contains sufficient metadata, return an IMP_Contents object reflecting that metadata.

If this object contains sufficient metadata, return an IMP_Contents object reflecting that metadata.

Returns

mixed
Either an IMP_Contents object or null.
public string
# replyType( boolean $base = false )

Return the reply type.

Return the reply type.

Parameters

$base
Return the base reply type?

Returns

string
The reply type, or null if not a reply.
public static string
# formatAddr( string $addr )

Formats the address properly.

Formats the address properly.

Parameters

$addr
The address to format.

Returns

string
The formatted address.
public static array
# expandAddresses( string $addrString, array $options = array() )

Uses the Registry to expand names and return error information for any address that is either not valid or fails to expand. This function will not search if the address string is empty.

Uses the Registry to expand names and return error information for any address that is either not valid or fails to expand. This function will not search if the address string is empty.

Parameters

$addrString
The name(s) or address(es) to expand.
$options
<p>Additional options: - levenshtein: (boolean) If true, will sort the results using the PHP levenshtein() scoring function.</p>

Returns

array
All matching addresses.
public static mixed
# getAddressList( string $search = '', boolean $email = false, boolean $count = false )

Uses the Registry to obtain a list of e-mail addresses in the addressbook.

Uses the Registry to obtain a list of e-mail addresses in the addressbook.

Parameters

$search
The term to search by.
$email
<p>Return the e-mail only? Otherwise, returns the full address.</p>
$count
Only return the count of results.

Returns

mixed

array|integer All matching addresses, or the count of matching results.

public
# offsetExists( mixed $offset )

Implementation of

ArrayAccess::offsetExists()
public
# offsetGet( mixed $offset )

Implementation of

ArrayAccess::offsetGet()
public
# offsetSet( mixed $offset, mixed $value )

Implementation of

ArrayAccess::offsetSet()
public
# offsetUnset( mixed $offset )

Implementation of

ArrayAccess::offsetUnset()
public
# __toString( )

String representation: the cache ID.

String representation: the cache ID.

public integer
# count( )

Returns the number of attachments currently in this message.

Returns the number of attachments currently in this message.

Returns

integer
The number of attachments in this message.

Implementation of

Countable::count()
public
# current( )

Implementation of

Iterator::current()
public
# key( )

Implementation of

Iterator::key()
public
# next( )

Implementation of

Iterator::next()
public
# rewind( )

Implementation of

Iterator::rewind()
public
# valid( )

Implementation of

Iterator::valid()
public
# serialize( )

Implementation of

Serializable::serialize()
public
# unserialize( mixed $data )

Implementation of

Serializable::unserialize()
Constants summary
string VFS_ATTACH_PATH
# '.horde/imp/compose'
string VFS_LINK_ATTACH_PATH
# '.horde/imp/attachments'
string VFS_DRAFTS_PATH
# '.horde/imp/drafts'
integer COMPOSE
# 0
integer REPLY
# 1
integer REPLY_ALL
# 2
integer REPLY_AUTO
# 3
integer REPLY_LIST
# 4
integer REPLY_SENDER
# 5
integer FORWARD
# 6
integer FORWARD_ATTACH
# 7
integer FORWARD_AUTO
# 8
integer FORWARD_BODY
# 9
integer FORWARD_BOTH
# 10
integer REDIRECT
# 11
string HTML_BLOCKQUOTE
# '<blockquote type="cite" style="border-left:2px solid blue;margin-left:8px;padding-left:8px;">'
Properties summary
public string $changed

Mark as changed for purposes of storing in the session. Either empty, 'changed', or 'deleted'.

Mark as changed for purposes of storing in the session. Either empty, 'changed', or 'deleted'.

# ''
public string $charset

The charset to use for sending.

The charset to use for sending.

#
API documentation generated by ApiGen