Documentation

IMP_Compose
in package
implements ArrayAccess, Countable, IteratorAggregate

An object representing an outgoing mail message.

Tags
author

Michael Slusarz slusarz@horde.org

category

Horde

copyright

2002-2017 Horde LLC

license

http://www.horde.org/licenses/gpl GPL

Table of Contents

Interfaces

ArrayAccess
Countable
IteratorAggregate

Constants

COMPOSE  = 0
DRAFT_FWD  = 'X-IMP-Forward'
DRAFT_HDR  = 'X-IMP-Draft'
DRAFT_REPLY  = 'X-IMP-Draft-Reply'
DRAFT_REPLY_TYPE  = 'X-IMP-Draft-Reply-Type'
EDITASNEW  = 12
FORWARD  = 6
FORWARD_ATTACH  = 7
FORWARD_AUTO  = 8
FORWARD_BODY  = 9
FORWARD_BOTH  = 10
HTML_BLOCKQUOTE  = '<blockquote type="cite" style="border-left:2px solid blue;margin-left:2px;padding-left:12px;">'
REDIRECT  = 11
RELATED_ATTR  = 'imp_related_attr'
REPLY  = 1
REPLY_ALL  = 2
REPLY_AUTO  = 3
REPLY_LIST  = 4
REPLY_SENDER  = 5
TEMPLATE  = 13
VFS_DRAFTS_PATH  = '.horde/imp/drafts'

Properties

$atcId  : int
Attachment ID counter.
$changed  : string
Mark as changed for purposes of storing in the session.
$charset  : string
The charset to use for sending.
$_atc  : array<string|int, mixed>
Attachment data.
$_cacheid  : string
The cache ID used to store object in session.
$_metadata  : array<string|int, mixed>
Various metadata for this message.
$_replytype  : int
The reply type.

Methods

__construct()  : mixed
Constructor.
__toString()  : string
String representation: the cache ID.
__wakeup()  : mixed
Tasks to do upon unserialize().
_getMessageTextCallback()  : string
Callback used in _getMessageText().
_saveRecipients()  : mixed
Save the recipients done in a sendMessage().
addAttachmentFromPart()  : IMP_Compose_Attachment
Adds an attachment from Horde_Mime_Part data.
addAttachmentFromUpload()  : array<string|int, mixed>
Add attachment from uploaded (form) data.
additionalAttachmentsAllowed()  : mixed
How many more attachments are allowed?
addRelatedAttachment()  : mixed
Add an attachment referred to in a related part.
attachImapMessage()  : string
Add mail message(s) from the mail server as a message/rfc822 attachment.
buildAndSendMessage()  : mixed
Builds and sends a MIME message.
canCompose()  : bool
Is composing messages allowed?
canHtmlCompose()  : bool
Is the HTML editor available for compostion?
canUploadAttachment()  : bool
Can attachments be uploaded?
count()  : int
Returns the number of attachments currently in this message.
deleteAllAttachments()  : mixed
Deletes all attachments.
destroy()  : mixed
Destroys an IMP_Compose instance.
editAsNew()  : mixed
Edits a message as new.
editTemplate()  : mixed
Edit an existing template message. Saving this template later (using saveTemplate()) will cause the original message to be deleted.
forwardMessage()  : array<string|int, mixed>
Determine the text and headers for a forwarded message.
forwardMessageText()  : array<string|int, mixed>
Returns the forward text for a message.
forwardMultipleMessages()  : array<string|int, mixed>
Prepares a forwarded message using multiple messages.
getCacheId()  : string
Obtains the cache ID for the session object.
getContentsOb()  : mixed
If this object contains sufficient metadata, return an IMP_Contents object reflecting that metadata.
getHmac()  : string
Generate HMAC hash used to validate data on a session expiration. Uses the unique compose cache ID of the expired message, the username, and the secret key of the server to generate a reproducible value that can be validated if session data doesn't exist.
getIterator()  : Traversable
getMetadata()  : mixed
Gets metadata about the current object.
hasDrafts()  : bool
Does this message have any drafts associated with it?
maxAttachmentSize()  : int
What is the maximum attachment size?
offsetExists()  : bool
offsetGet()  : mixed
offsetSet()  : void
offsetUnset()  : void
recipientList()  : array<string|int, mixed>
Cleans up and returns the recipient list. Method designed to parse user entered data; does not encode/validate addresses.
recoverSessionExpireDraft()  : mixed
Restore session expiration draft compose data.
redirectMessage()  : mixed
Prepare a redirect message.
replyMessage()  : array<string|int, mixed>
Determines the reply text and headers for a message.
replyMessageText()  : array<string|int, mixed>
Returns the reply text for a message.
replyType()  : string
Return the reply type.
resumeDraft()  : mixed
Resumes a previously saved draft message.
saveDraft()  : string
Saves a draft message.
saveTemplate()  : string
Save a template message on the IMAP server.
sendMessage()  : mixed
Sends a message.
sendRedirectMessage()  : array<string|int, mixed>
Send a redirect (a/k/a resent) message. See RFC 5322 [3.6.6].
sessionExpireDraft()  : mixed
Store draft compose data if session expires.
text2html()  : string
Shortcut function to convert text -> HTML for purposes of composition.
useTemplate()  : mixed
Uses a template to create a message.
_addAttachment()  : IMP_Compose_Attachment
Adds an attachment to the outgoing compose message.
_cleanHtmlOutput()  : mixed
Clean outgoing HTML (remove unexpected data URLs).
_convertToRelated()  : Horde_Mime_Part
Converts an HTML part to a multipart/related part, if necessary.
_createMimeMessage()  : Horde_Mime_Part
Create the base Horde_Mime_Part for sending.
_encryptMessage()  : Horde_Mime_Part
Encrypt an outgoing message.
_getMatchingIdentity()  : int
Get "tieto" identity information.
_getMessageText()  : mixed
Regenerates body text for use in the compose screen from IMAP data.
_getMsgHeaders()  : string
Determine the header information to display in the forward/reply.
_linkAttachments()  : mixed
Adds linked attachments to message.
_logSentmail()  : string
Log a sent action to the sentmail backend.
_msgTextFormat()  : array<string|int, mixed>
Determine text editor format.
_prepareHeaders()  : Horde_Mime_Headers
Prepare header object with basic header fields and converts headers to the current compose charset.
_prepSendMessage()  : string
Sanity checking/MIME formatting before sending a message.
_prepSendMessageAssert()  : mixed
Recipiet checks to do if this is a user-generated compose message.
_prepSendMessageEncode()  : string
Encode address and do sanity checking on encoded address.
_resumeDraft()  : mixed
Resumes a previously saved draft message.
_saveDraftMsg()  : string
Prepare the draft message.
_saveDraftServer()  : string
Save a draft message on the IMAP server.
_saveToSentMail()  : mixed
Save message to sent-mail mailbox, if configured to do so.
_setMetadata()  : mixed
Sets metadata for the current object.

Constants

DRAFT_FWD

public mixed DRAFT_FWD = 'X-IMP-Forward'

DRAFT_HDR

public mixed DRAFT_HDR = 'X-IMP-Draft'

DRAFT_REPLY

public mixed DRAFT_REPLY = 'X-IMP-Draft-Reply'

DRAFT_REPLY_TYPE

public mixed DRAFT_REPLY_TYPE = 'X-IMP-Draft-Reply-Type'

EDITASNEW

public mixed EDITASNEW = 12

FORWARD_ATTACH

public mixed FORWARD_ATTACH = 7

FORWARD_AUTO

public mixed FORWARD_AUTO = 8

FORWARD_BODY

public mixed FORWARD_BODY = 9

FORWARD_BOTH

public mixed FORWARD_BOTH = 10

HTML_BLOCKQUOTE

public mixed HTML_BLOCKQUOTE = '<blockquote type="cite" style="border-left:2px solid blue;margin-left:2px;padding-left:12px;">'
public mixed RELATED_ATTR = 'imp_related_attr'

REPLY_ALL

public mixed REPLY_ALL = 2

REPLY_AUTO

public mixed REPLY_AUTO = 3

REPLY_LIST

public mixed REPLY_LIST = 4

REPLY_SENDER

public mixed REPLY_SENDER = 5

VFS_DRAFTS_PATH

public mixed VFS_DRAFTS_PATH = '.horde/imp/drafts'

Properties

$atcId

Attachment ID counter.

public int $atcId = 0

$changed

Mark as changed for purposes of storing in the session.

public string $changed = ''

Either empty, 'changed', or 'deleted'.

$charset

The charset to use for sending.

public string $charset

$_atc

Attachment data.

protected array<string|int, mixed> $_atc = array()

$_cacheid

The cache ID used to store object in session.

protected string $_cacheid

$_metadata

Various metadata for this message.

protected array<string|int, mixed> $_metadata = array()

$_replytype

The reply type.

protected int $_replytype = self::COMPOSE

Methods

__construct()

Constructor.

public __construct(string $cacheid) : mixed
Parameters
$cacheid : string

The cache ID string.

__toString()

String representation: the cache ID.

public __toString() : string
Return values
string

__wakeup()

Tasks to do upon unserialize().

public __wakeup() : mixed

_getMessageTextCallback()

Callback used in _getMessageText().

public _getMessageTextCallback(mixed $id, mixed $attribute, mixed $node) : string
Parameters
$id : mixed
$attribute : mixed
$node : mixed
Return values
string

Replacement text.

_saveRecipients()

Save the recipients done in a sendMessage().

public _saveRecipients(Horde_Mail_Rfc822_List $recipients) : mixed
Parameters
$recipients : Horde_Mail_Rfc822_List

The list of recipients.

addAttachmentFromUpload()

Add attachment from uploaded (form) data.

public addAttachmentFromUpload(string $field) : array<string|int, mixed>
Parameters
$field : string

The form field name.

Tags
throws
IMP_Compose_Exception
Return values
array<string|int, mixed>

A list of IMP_Compose_Attachment objects (if successfully attached) or IMP_Compose_Exception objects (if error when attaching).

additionalAttachmentsAllowed()

How many more attachments are allowed?

public additionalAttachmentsAllowed() : mixed
Return values
mixed

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

addRelatedAttachment()

Add an attachment referred to in a related part.

public addRelatedAttachment(IMP_Compose_Attachment $atc_ob, DOMElement $node, string $attribute) : mixed
Parameters
$atc_ob : IMP_Compose_Attachment
$node : DOMElement

Node element containg the related reference.

$attribute : string

Element attribute containing the related reference.

attachImapMessage()

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

public attachImapMessage(IMP_Indices $indices) : string
Parameters
$indices : IMP_Indices

An indices object.

Tags
throws
IMP_Exception
Return values
string

Subject string.

buildAndSendMessage()

Builds and sends a MIME message.

public buildAndSendMessage(string $body, array<string|int, mixed> $header, IMP_Prefs_Identity $identity[, array<string|int, mixed> $opts = array() ]) : mixed
Parameters
$body : string

The message body.

$header : array<string|int, mixed>

List of message headers.

$identity : IMP_Prefs_Identity

The Identity object for the sender of this message.

$opts : array<string|int, mixed> = array()

An array of options w/the following keys:

  • encrypt: (integer) A flag whether to encrypt or sign the message. One of:
    • IMP_Pgp::ENCRYPT
    • IMP_Pgp::SIGNENC
    • IMP_Smime::ENCRYPT
    • IMP_Smime::SIGNENC
  • html: (boolean) Whether this is an HTML message. DEFAULT: false
  • pgp_attach_pubkey: (boolean) Attach the user's PGP public key to the message?
  • priority: (string) The message priority ('high', 'normal', 'low').
  • save_sent: (boolean) Save sent mail?
  • sent_mail: (IMP_Mailbox) The sent-mail mailbox (UTF-8).
  • strip_attachments: (bool) Strip attachments from the message?
  • signature: (string) The message signature.
  • readreceipt: (boolean) Add return receipt headers?
  • useragent: (string) The User-Agent string to use.
  • vcard_attach: (string) Attach the user's vCard (value is name to display as vcard filename).
Tags
throws
Horde_Exception
throws
IMP_Compose_Exception
throws
IMP_Compose_Exception_Address
throws
IMP_Exception

canCompose()

Is composing messages allowed?

public static canCompose() : bool
Tags
throws
Horde_Exception
Return values
bool

True if compose allowed.

canHtmlCompose()

Is the HTML editor available for compostion?

public static canHtmlCompose() : bool
Return values
bool

True if HTML editor is available.

canUploadAttachment()

Can attachments be uploaded?

public static canUploadAttachment() : bool
Return values
bool

True if attachments can be uploaded.

count()

Returns the number of attachments currently in this message.

public count() : int
Return values
int

The number of attachments in this message.

deleteAllAttachments()

Deletes all attachments.

public deleteAllAttachments() : mixed

destroy()

Destroys an IMP_Compose instance.

public destroy(string $action) : mixed
Parameters
$action : string

The action performed to cause the end of this instance. Either 'cancel', 'discard', 'save_draft', or 'send'.

editAsNew()

Edits a message as new.

public editAsNew(IMP_Indices $indices[, array<string|int, mixed> $opts = array() ]) : mixed
Parameters
$indices : IMP_Indices

An indices object.

$opts : array<string|int, mixed> = array()

Additional options:

  • format: (string) Force to this format. DEFAULT: Auto-determine.
Tags
see

resumeDraft().

throws
IMP_Compose_Exception
Return values
mixed

See resumeDraft().

editTemplate()

Edit an existing template message. Saving this template later (using saveTemplate()) will cause the original message to be deleted.

public editTemplate(IMP_Indices $indices) : mixed
Parameters
$indices : IMP_Indices

An indices object.

Tags
throws
IMP_Compose_Exception
Return values
mixed

See resumeDraft().

forwardMessage()

Determine the text and headers for a forwarded message.

public forwardMessage(int $type, IMP_Contents $contents[, bool $attach = true ][, array<string|int, mixed> $opts = array() ]) : array<string|int, mixed>
Parameters
$type : int

The forward type (self::FORWARD* constant).

$contents : IMP_Contents

An IMP_Contents object.

$attach : bool = true

Attach the forwarded message?

$opts : array<string|int, mixed> = array()

Additional options:

  • format: (string) Force to this format. DEFAULT: Auto-determine.
Tags
throws
IMP_Exception
Return values
array<string|int, mixed>

An array with the following keys:

  • attach: (boolean) True if original message was attached.
  • body: (string) The text of the body part.
  • format: (string) The format of the body message ('html', 'text').
  • identity: (mixed) See IMP_Prefs_Identity#getMatchingIdentity().
  • subject: (string) Formatted subject.
  • title: (string) Title to use on page.
  • type: (integer) - The compose type.

forwardMessageText()

Returns the forward text for a message.

public forwardMessageText(IMP_Contents $contents[, array<string|int, mixed> $opts = array() ]) : array<string|int, mixed>
Parameters
$contents : IMP_Contents

An IMP_Contents object.

$opts : array<string|int, mixed> = array()

Additional options:

  • format: (string) Force to this format. DEFAULT: Auto-determine.
Return values
array<string|int, mixed>

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').

forwardMultipleMessages()

Prepares a forwarded message using multiple messages.

public forwardMultipleMessages(IMP_Indices $indices) : array<string|int, mixed>
Parameters
$indices : IMP_Indices

An indices object containing the indices of the forwarded messages.

Return values
array<string|int, mixed>

An array with the following keys:

  • body: (string) The text of the body part.
  • format: (string) The format of the body message ('html', 'text').
  • identity: (mixed) See IMP_Prefs_Identity#getMatchingIdentity().
  • subject: (string) Formatted subject.
  • title: (string) Title to use on page.
  • type: (integer) The compose type.

getCacheId()

Obtains the cache ID for the session object.

public getCacheId() : string
Return values
string

The message cache ID.

getContentsOb()

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

public getContentsOb() : mixed
Return values
mixed

Either an IMP_Contents object or null.

getHmac()

Generate HMAC hash used to validate data on a session expiration. Uses the unique compose cache ID of the expired message, the username, and the secret key of the server to generate a reproducible value that can be validated if session data doesn't exist.

public getHmac([string $cacheid = null ][, string $user = null ]) : string
Parameters
$cacheid : string = null

The cache ID to use. If null, uses cache ID of the compose object.

$user : string = null

The user ID to use. If null, uses the current authenticated username.

Return values
string

The HMAC hash string.

getIterator()

public getIterator() : Traversable
Return values
Traversable

getMetadata()

Gets metadata about the current object.

public getMetadata(string $name) : mixed
Parameters
$name : string

The metadata name.

Return values
mixed

The metadata value or null if it doesn't exist.

hasDrafts()

Does this message have any drafts associated with it?

public hasDrafts() : bool
Return values
bool

True if draft messages exist.

maxAttachmentSize()

What is the maximum attachment size?

public static maxAttachmentSize() : int
Return values
int

The maximum attachment size (in bytes).

offsetExists()

public offsetExists(mixed $offset) : bool
Parameters
$offset : mixed
Return values
bool

offsetGet()

public offsetGet(mixed $offset) : mixed
Parameters
$offset : mixed

offsetSet()

public offsetSet(mixed $offset, mixed $value) : void
Parameters
$offset : mixed
$value : mixed

offsetUnset()

public offsetUnset(mixed $offset) : void
Parameters
$offset : mixed

recipientList()

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

public recipientList(array<string|int, mixed> $hdr) : array<string|int, mixed>
Parameters
$hdr : array<string|int, mixed>

An array of MIME headers and/or address list objects. Recipients will be extracted from the 'to', 'cc', and 'bcc' entries.

Return values
array<string|int, mixed>

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' address list (Horde_Mail_Rfc822_List objects).
  • list: (Horde_Mail_Rfc822_List) Recipient addresses.

recoverSessionExpireDraft()

Restore session expiration draft compose data.

public recoverSessionExpireDraft() : mixed

redirectMessage()

Prepare a redirect message.

public redirectMessage(IMP_Indices $indices) : mixed
Parameters
$indices : IMP_Indices

An indices object.

replyMessage()

Determines the reply text and headers for a message.

public replyMessage(int $type, IMP_Contents $contents[, array<string|int, mixed> $opts = array() ]) : array<string|int, mixed>
Parameters
$type : int

The reply type (self::REPLY* constant).

$contents : IMP_Contents

An IMP_Contents object.

$opts : array<string|int, mixed> = array()

Additional options:

  • format: (string) Force to this format. DEFAULT: Auto-determine.
  • to: (string) The recipient of the reply. Overrides the automatically determined value.
Tags
throws
IMP_Exception
Return values
array<string|int, mixed>

An array with the following keys:

  • addr: (array) Address lists (to, cc, bcc; Horde_Mail_Rfc822_List objects).
  • body: (string) The text of the body part.
  • format: (string) The format of the body message (html, text).
  • identity: (integer) The identity to use for the reply based on the original message's addresses.
  • lang: (array) Language code (keys)/language name (values) of the original sender's preferred language(s).
  • reply_list_id: (string) List ID label.
  • reply_recip: (integer) Number of recipients in reply list.
  • subject: (string) Formatted subject.
  • type: (integer) The reply type used (either self::REPLY_ALL, self::REPLY_LIST, or self::REPLY_SENDER).

replyMessageText()

Returns the reply text for a message.

public replyMessageText(IMP_Contents $contents[, array<string|int, mixed> $opts = array() ]) : array<string|int, mixed>
Parameters
$contents : IMP_Contents

An IMP_Contents object.

$opts : array<string|int, mixed> = array()

Additional options:

  • format: (string) Force to this format. DEFAULT: Auto-determine.
Return values
array<string|int, mixed>

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').

replyType()

Return the reply type.

public replyType([bool $base = false ]) : string
Parameters
$base : bool = false

Return the base reply type?

Return values
string

The reply type, or null if not a reply.

resumeDraft()

Resumes a previously saved draft message.

public resumeDraft(IMP_Indices $indices[, array<string|int, mixed> $opts = array() ]) : mixed
Parameters
$indices : IMP_Indices

An indices object.

$opts : array<string|int, mixed> = array()

Additional options:

  • format: (string) Force to this format. DEFAULT: Auto-determine.
Tags
throws
IMP_Compose_Exception
Return values
mixed

An array with the following keys:

  • addr: (array) Address lists (to, cc, bcc; Horde_Mail_Rfc822_List objects).
  • body: (string) The text of the body part.
  • format: (string) The format of the body message ('html', 'text').
  • identity: (mixed) See IMP_Prefs_Identity#getMatchingIdentity().
  • priority: (string) The message priority.
  • readreceipt: (boolean) Add return receipt headers?
  • subject: (string) Formatted subject.
  • type: (integer) - The compose type.

saveDraft()

Saves a draft message.

public saveDraft(array<string|int, mixed> $headers, mixed $message[, array<string|int, mixed> $opts = array() ]) : string
Parameters
$headers : array<string|int, mixed>

List of message headers (UTF-8).

$message : mixed

Either the message text (string) or a Horde_Mime_Part object that contains the text to send.

$opts : array<string|int, mixed> = array()

An array of options w/the following keys:

  • autosave: (boolean) Is this an auto-saved draft?
  • html: (boolean) Is this an HTML message?
  • priority: (string) The message priority ('high', 'normal', 'low').
  • readreceipt: (boolean) Add return receipt headers?
Tags
throws
IMP_Compose_Exception
Return values
string

Notification text on success (not HTML encoded).

saveTemplate()

Save a template message on the IMAP server.

public saveTemplate(array<string|int, mixed> $headers, mixed $message[, array<string|int, mixed> $opts = array() ]) : string
Parameters
$headers : array<string|int, mixed>

List of message headers (UTF-8).

$message : mixed

Either the message text (string) or a Horde_Mime_Part object that contains the text to save.

$opts : array<string|int, mixed> = array()

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?
Tags
throws
IMP_Compose_Exception
Return values
string

Notification text on success.

sendMessage()

Sends a message.

public sendMessage(Horde_Mail_Rfc822_List $email, Horde_Mime_Headers $headers, Horde_Mime_Part $message) : mixed
Parameters
$email : Horde_Mail_Rfc822_List

The e-mail list to send to.

$headers : Horde_Mime_Headers

The object holding this message's headers.

$message : Horde_Mime_Part

The object that contains the text to send.

Tags
throws
IMP_Compose_Exception

sendRedirectMessage()

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

public sendRedirectMessage(mixed $to[, bool $log = true ]) : array<string|int, mixed>
Parameters
$to : mixed

The addresses to redirect to.

$log : bool = true

Whether to log the resending in the history and sentmail log.

Tags
throws
IMP_Compose_Exception
Return values
array<string|int, mixed>

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.

sessionExpireDraft()

Store draft compose data if session expires.

public sessionExpireDraft(Horde_Variables $vars) : mixed
Parameters
$vars : Horde_Variables

Object with the form data.

text2html()

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

public static text2html(string $msg) : string
Parameters
$msg : string

The message text.

Return values
string

HTML text.

useTemplate()

Uses a template to create a message.

public useTemplate(IMP_Indices $indices[, array<string|int, mixed> $opts = array() ]) : mixed
Parameters
$indices : IMP_Indices

An indices object.

$opts : array<string|int, mixed> = array()

Additional options:

  • format: (string) Force to this format. DEFAULT: Auto-determine.
Tags
see

resumeDraft().

throws
IMP_Compose_Exception
Return values
mixed

See resumeDraft().

_addAttachment()

Adds an attachment to the outgoing compose message.

protected _addAttachment(string $atc_file, int $bytes, string $filename, string $type) : IMP_Compose_Attachment
Parameters
$atc_file : string

Temporary file containing attachment contents.

$bytes : int

Size of data, in bytes.

$filename : string

Filename of data.

$type : string

MIME type of data.

Tags
throws
IMP_Compose_Exception
Return values
IMP_Compose_Attachment

Attachment object.

_cleanHtmlOutput()

Clean outgoing HTML (remove unexpected data URLs).

protected _cleanHtmlOutput(Horde_Domhtml $html) : mixed
Parameters
$html : Horde_Domhtml

The HTML data.

_convertToRelated()

Converts an HTML part to a multipart/related part, if necessary.

protected _convertToRelated(Horde_Domhtml $html, Horde_Mime_Part $part) : Horde_Mime_Part
Parameters
$html : Horde_Domhtml

HTML data.

$part : Horde_Mime_Part

The HTML part.

Return values
Horde_Mime_Part

The part to add to the compose output.

_createMimeMessage()

Create the base Horde_Mime_Part for sending.

protected _createMimeMessage(string $body[, array<string|int, mixed> $options = array() ]) : Horde_Mime_Part
Parameters
$body : string

Message body.

$options : array<string|int, mixed> = array()

Additional options:

  • html: (boolean) Is this a HTML message?
  • identity: (IMP_Prefs_Identity) Identity of the sender.
  • nofinal: (boolean) This is not a message which will be sent out.
  • noattach: (boolean) Don't add attachment information.
  • pgp_attach_pubkey: (boolean) Attach the user's PGP public key?
  • recip: (Horde_Mail_Rfc822_List) The recipient list.
  • signature: (IMP_Prefs_Identity|string) If set, add the signature to the message.
  • vcard_attach: (string) If set, attach user's vcard to message.
Tags
throws
Horde_Exception
throws
IMP_Compose_Exception
Return values
Horde_Mime_Part

The base MIME part.

_encryptMessage()

Encrypt an outgoing message.

protected _encryptMessage(Horde_Mime_Part $msg, int $encrypt, Horde_Mail_Rfc822_List $recip, Horde_Mail_Rfc822_Address $from) : Horde_Mime_Part
Parameters
$msg : Horde_Mime_Part

Outgoing message.

$encrypt : int

Encryption type.

$recip : Horde_Mail_Rfc822_List

Recipient list.

$from : Horde_Mail_Rfc822_Address

Sending address.

Return values
Horde_Mime_Part

$msg Processed outgoing message.

_getMatchingIdentity()

Get "tieto" identity information.

protected _getMatchingIdentity(Horde_Mime_Headers $h[, array<string|int, mixed> $only = array() ]) : int
Parameters
$h : Horde_Mime_Headers

The headers object for the message.

$only : array<string|int, mixed> = array()

Only use these headers.

Return values
int

The matching identity. If no exact match, returns the default identity.

_getMessageText()

Regenerates body text for use in the compose screen from IMAP data.

protected _getMessageText(IMP_Contents $contents[, array<string|int, mixed> $options = array() ]) : mixed
Parameters
$contents : IMP_Contents

An IMP_Contents object.

$options : array<string|int, mixed> = array()

Additional options:

  • html: (boolean) Return text/html part, if available.
  • imp_msg: (integer) If non-empty, the message data was created by IMP. Either:
    • self::COMPOSE
    • self::FORWARD
    • self::REPLY
  • replylimit: (boolean) Enforce length limits?
  • toflowed: (boolean) Do flowed conversion?
Return values
mixed

Null if bodypart not found, or array with the following keys:

  • charset: (string) The guessed charset to use.
  • flowed: (Horde_Text_Flowed) A flowed object, if the text is flowed. Otherwise, null.
  • id: (string) The MIME ID of the bodypart.
  • mode: (string) Either 'text' or 'html'.
  • text: (string) The body text.

_getMsgHeaders()

Determine the header information to display in the forward/reply.

protected _getMsgHeaders(Horde_Mime_Headers $h) : string
Parameters
$h : Horde_Mime_Headers

The headers object for the message.

Return values
string

The header information for the original message.

_linkAttachments()

Adds linked attachments to message.

protected _linkAttachments(string &$body, mixed $html) : mixed
Parameters
$body : string

Plaintext data.

$html : mixed

HTML data (Horde_Domhtml) or null.

Tags
throws
IMP_Compose_Exception

_logSentmail()

Log a sent action to the sentmail backend.

protected _logSentmail(Horde_Mime_Headers $headers, Horde_Mail_Rfc822_List $recip, bool $success) : string
Parameters
$headers : Horde_Mime_Headers

Message headers.

$recip : Horde_Mail_Rfc822_List

Message recipients.

$success : bool

Send success.

Return values
string

Message-ID value.

_msgTextFormat()

Determine text editor format.

protected _msgTextFormat(array<string|int, mixed> $opts, string $pref_name) : array<string|int, mixed>
Parameters
$opts : array<string|int, mixed>

Options (contains 'format' param).

$pref_name : string

The pref name that controls formatting.

Return values
array<string|int, mixed>

Use HTML? and Force HTML?

_prepareHeaders()

Prepare header object with basic header fields and converts headers to the current compose charset.

protected _prepareHeaders(array<string|int, mixed> $headers[, array<string|int, mixed> $opts = array() ]) : Horde_Mime_Headers
Parameters
$headers : array<string|int, mixed>

Array with 'from', 'to', 'cc', 'bcc', and 'subject' values.

$opts : array<string|int, mixed> = array()

An array of options w/the following keys:

  • priority: (string) The message priority ('high', 'normal', 'low').
Return values
Horde_Mime_Headers

Headers object with the appropriate headers set.

_prepSendMessage()

Sanity checking/MIME formatting before sending a message.

protected _prepSendMessage(Horde_Mail_Rfc822_List $email[, Horde_Mime_Part $message = null ]) : string
Parameters
$email : Horde_Mail_Rfc822_List

The e-mail list to send to.

$message : Horde_Mime_Part = null

The object that contains the text to send.

Tags
throws
IMP_Compose_Exception
Return values
string

The encoded $email list.

_prepSendMessageAssert()

Recipiet checks to do if this is a user-generated compose message.

protected _prepSendMessageAssert(Horde_Mail_Rfc822_List $email) : mixed
Parameters
$email : Horde_Mail_Rfc822_List

The e-mail list to send to.

Tags
throws
IMP_Compose_Exception

_prepSendMessageEncode()

Encode address and do sanity checking on encoded address.

protected _prepSendMessageEncode(Horde_Mail_Rfc822_List $email, string $charset) : string
Parameters
$email : Horde_Mail_Rfc822_List

The e-mail list to send to.

$charset : string

The charset to encode to.

Tags
throws
IMP_Compose_Exception_Address
Return values
string

The encoded $email list.

_resumeDraft()

Resumes a previously saved draft message.

protected _resumeDraft(IMP_Indices $indices, int $type, array<string|int, mixed> $opts) : mixed
Parameters
$indices : IMP_Indices

See resumeDraft().

$type : int

Compose type.

$opts : array<string|int, mixed>

Additional options:

  • format: (string) Force to this format. DEFAULT: Auto-determine.
Tags
throws
IMP_Compose_Exception
Return values
mixed

See resumeDraft().

_saveDraftMsg()

Prepare the draft message.

protected _saveDraftMsg(array<string|int, mixed> $headers, mixed $message, array<string|int, mixed> $opts) : string
Parameters
$headers : array<string|int, mixed>

List of message headers.

$message : mixed

Either the message text (string) or a Horde_Mime_Part object that contains the text to send.

$opts : array<string|int, mixed>

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?
  • verify_email: (boolean) Verify e-mail messages? Default: no.
Tags
throws
IMP_Compose_Exception
Return values
string

The body text.

_saveDraftServer()

Save a draft message on the IMAP server.

protected _saveDraftServer(string $data) : string
Parameters
$data : string

The text of the draft message.

Tags
throws
IMP_Compose_Exception
Return values
string

Status string (not HTML escaped).

_saveToSentMail()

Save message to sent-mail mailbox, if configured to do so.

protected _saveToSentMail(Horde_Mime_Headers $headers, Horde_Mime_Part $save_msg, Horde_Mail_Rfc822_List $recips, array<string|int, mixed> $opts) : mixed
Parameters
$headers : Horde_Mime_Headers

Headers object.

$save_msg : Horde_Mime_Part

Message data to save.

$recips : Horde_Mail_Rfc822_List

Recipient list.

$opts : array<string|int, mixed>

See buildAndSendMessage()

_setMetadata()

Sets metadata for the current object.

protected _setMetadata(string $name, mixed $value) : mixed
Parameters
$name : string

The metadata name.

$value : mixed

The metadata value.


        
On this page

Search results