Property | Type | Description | |
---|---|---|---|
$defaultCharset | string | The default charset to use when parsing text parts with no charset information. | |
$encodingTypes | |||
$memoryLimit | integer | The memory limit for use with the PHP temp stream. | |
$mimeTypes | |||
$parent | Horde_Mime_Part | Parent object. Value only accurate when iterating. |
Property | Type | Description | |
---|---|---|---|
$_bytes | integer | Default value for this Part's size. | |
$_contents | resource | The body of the part. Always stored in binary format. | |
$_eol | string | The default is currently to output the EOL sequence internally as
just "\n" instead of the canonical "\r\n" required in RFC 822 & 2045.
To be RFC complaint, the full |
|
$_failed | boolean | Flag to detect if a message failed to send at least once. | |
$_hdrCharset | string | The charset to output the headers in. | |
$_headers | Horde_Mime_Headers | The MIME headers for this part. | |
$_metadata | array | Metadata. | |
$_mimeid | string | The MIME ID of this part. | |
$_parts | array | The subparts of this part. | |
$_status | integer | Status mask for this part. | |
$_temp | array | Temporary array. | |
$_transferEncoding | string | The desired transfer encoding of this part. |
Method | Description | |
---|---|---|
__clone ( ) | Function to run on clone. | |
__construct ( ) | Constructor. | |
addMimeHeaders ( array $options = [] ) : Horde_Mime_Headers | Returns a Horde_Mime_Header object containing all MIME headers needed for the part. | |
addPart ( $mime_part ) | ||
alterPart ( $id, $mime_part ) | ||
appendContents ( mixed $contents, $options = [] ) | Add to the body contents of this part. | |
buildMimeIds ( string $id = null, boolean $rfc822 = false ) | Build the MIME IDs for this part and all subparts. | |
clearContentTypeParameter ( $label ) | ||
clearContents ( ) | Clears the body contents of this part. | |
contentTypeMap ( $sort = true ) | ||
count ( ) : integer | Returns the number of child message parts (doesn't include grandchildren or more remote ancestors). | |
current ( ) | ||
findBody ( string $subtype = null ) : mixed | Finds the main "body" text part (if any) in a message. | |
getAllContentTypeParameters ( ) : array | Get all parameters from the Content-Type header. | |
getAllDispositionParameters ( ) : array | Get all parameters from the Content-Disposition header. | |
getBytes ( boolean $approx = false ) : integer | Determine the size of this MIME part and its child members. | |
getCharset ( ) : string | Get the character set to use for this part. | |
getChildren ( ) | ||
getContentId ( ) : string | Returns the Content-ID for this part. | |
getContentTypeParameter ( string $label ) : string | Get a content type parameter from this part. | |
getContents ( array $options = [] ) : mixed | Return the body of the part. | |
getDefaultType ( ) : string | If the subtype of a MIME part is unrecognized by an application, the default type should be used instead (See RFC 2046). This method returns the default subtype for a particular primary MIME type. | |
getDescription ( boolean $default = false ) : string | Get the description of this part. | |
getDisposition ( ) : string | Get the content-disposition of this part. | |
getDispositionParameter ( string $label ) : string | Get a disposition parameter from this part. | |
getDuration ( ) : integer | Get the content duration of the data contained in this part (see RFC 3803). | |
getEOL ( ) : string | Get the string to use for EOLs. | |
getHeaderCharset ( ) : string | Get the character set to use when outputting MIME headers. | |
getLanguage ( ) | Get the language(s) of this part. | |
getMetadata ( string $key ) : mixed | Retrieves metadata from this object. | |
getMimeId ( ) : string | Returns the MIME ID of this part. | |
getName ( boolean $default = false ) : string | Get the name of this part. | |
getPart ( $id ) | ||
getPartByIndex ( $index ) : Horde_Mime_Part | Returns a subpart by index. | |
getParts ( ) : array | Get a list of all MIME subparts. | |
getPrimaryType ( ) : string | Get the primary type of this part. | |
getRawPartText ( mixed $text, string $type, string $id ) : string | Attempts to obtain the raw text of a MIME part. | |
getSize ( boolean $approx = false ) : string | Output the size of this MIME part in KB. | |
getSubType ( ) : string | Get the subtype of this part. | |
getType ( boolean $charset = false ) : string | Get the full MIME Content-Type of this part. | |
hasChildren ( ) | ||
isAttachment ( ) : boolean | Determines if this MIME part is an attachment for display purposes. | |
isBasePart ( boolean $base ) | Is this the base MIME part? | |
key ( ) | ||
next ( ) | ||
offsetExists ( $offset ) | ||
offsetGet ( $offset ) | ||
offsetSet ( $offset, $value ) | ||
offsetUnset ( $offset ) | ||
parseMessage ( string $text, array $opts = [] ) : Horde_Mime_Part | Attempts to build a Horde_Mime_Part object from message text. | |
partIterator ( boolean $current = true ) : Iterator | Returns the recursive iterator needed to iterate through this part. | |
removePart ( $id ) | ||
replaceEOL ( mixed $text, string $eol = null, boolean $stream = false ) : string | Replace newlines in this part's contents with those specified by either the given newline sequence or the part's current EOL setting. | |
rewind ( ) | ||
send ( string $email, Horde_Mime_Headers $headers, Horde_Mail_Transport $mailer, array $opts = [] ) | Sends this message. | |
serialize ( ) : string | Serialization. | |
setBytes ( integer $bytes ) | Explicitly set the size (in bytes) of this part. This value will only be returned (via getBytes()) if there are no contents currently set. | |
setCharset ( string $charset ) | Set the character set of this part. | |
setContentId ( string $cid = null ) : string | Sets the Content-ID header for this part. | |
setContentTypeParameter ( string $label, string $data ) | Add/remove a content type parameter to this part. | |
setContents ( mixed $contents, array $options = [] ) | Set the body contents of this part. | |
setDescription ( string $description ) | Set the description of this part. | |
setDisposition ( string $disposition = null ) | Set the content-disposition of this part. | |
setDispositionParameter ( string $label, string $data ) | Add a disposition parameter to this part. | |
setDuration ( integer $duration ) | Set the content duration of the data contained in this part (see RFC 3803). | |
setEOL ( string $eol ) | Sets a new string to use for EOLs. | |
setHeaderCharset ( string $charset ) | Set the character set to use when outputting MIME headers. | |
setLanguage ( mixed $lang ) | Set the language(s) of this part. | |
setMetadata ( string $key, mixed $data = null ) | Set a piece of metadata on this object. | |
setMimeId ( string $mimeid ) | Alter the MIME ID of this part. | |
setName ( string $name ) | Set the name of this part. | |
setTransferEncoding ( string $encoding, array $options = [] ) | Set the transfer encoding to use for this part. | |
setType ( string $type ) | Set the MIME type of this part. | |
toString ( array $options = [] ) : mixed | Return the entire part in MIME format. | |
unserialize ( string $data ) | Unserialization. | |
valid ( ) |
Method | Description | |
---|---|---|
_findBoundary ( string $text, integer $pos, string $boundary, integer $end = null ) : array | Find the location of the next boundary string. | |
_findHeader ( string $text, string $eol ) : integer | Find the location of the end of the header text. | |
_getStructure ( string $header, string $body, array $opts = [] ) : Horde_Mime_Part | Creates a MIME object from the text of one part of a MIME message. | |
_getTransferEncoding ( integer $encode = self::ENCODE_7BIT ) : string | Get the transfer encoding for the part based on the user requested transfer encoding and the current contents of the part. | |
_reEncodeMessageAttachment ( Horde_Mime_Part $part ) | Rebuilds $part and forces it to be a base64 encoded application/octet-stream part. | |
_readStream ( resource $fp, boolean $close = false ) : string | Read data from a stream. | |
_reindex ( boolean $force = false ) | Reindexes the MIME IDs, if necessary. | |
_sanityCheckRfc822Attachments ( ) | Re-enocdes message/rfc822 parts in case there was e.g., some broken line length in the headers of the message in the part. Since we shouldn't alter the original message in any way, we simply reset cause the part to be encoded as base64 and sent as a application/octet part. | |
_scanStream ( resource $fp ) | Scans a stream for content type. | |
_transferDecode ( resource $fp, string $encoding ) : resource | Decodes the contents of the part to binary encoding. | |
_transferEncode ( resource $fp, string $encoding ) : resource | Encodes the contents of the part as necessary for transport. | |
_writeStream ( array $data, array $options = [] ) : resource | Write data to a stream. |
protected static _findBoundary ( string $text, integer $pos, string $boundary, integer $end = null ) : array | ||
$text | string | The text to search. |
$pos | integer | The current position in $text. |
$boundary | string | The boundary string. |
$end | integer | If set, return after matching this many boundaries. |
return | array | Keys are the boundary number, values are an array with two elements: 'start' and 'length'. |
protected static _getStructure ( string $header, string $body, array $opts = [] ) : Horde_Mime_Part | ||
$header | string | The header text. |
$body | string | The body text. |
$opts | array | Additional options:
- ctype: (string) The default content-type. - forcemime: (boolean) If true, the message data is assumed to be MIME data. If not, a MIME-Version header must exist to be parsed as a MIME message. - level: (integer) Current nesting level. - no_body: (boolean) If true, don't set body contents of parts. |
return | Horde_Mime_Part | The MIME part object. |
protected _getTransferEncoding ( integer $encode = self::ENCODE_7BIT ) : string | ||
$encode | integer | A mask of allowable encodings. |
return | string | The transfer-encoding of this part. |
protected _reEncodeMessageAttachment ( Horde_Mime_Part $part ) | ||
$part | Horde_Mime_Part | The MIME part. |
protected _readStream ( resource $fp, boolean $close = false ) : string | ||
$fp | resource | An active stream. |
$close | boolean | Close the stream when done reading? |
return | string | The data from the stream. |
protected _sanityCheckRfc822Attachments ( ) |
protected _scanStream ( resource $fp ) | ||
$fp | resource | A stream resource. |
protected _transferDecode ( resource $fp, string $encoding ) : resource | ||
$fp | resource | A stream containing the data to decode. |
$encoding | string | The original file encoding. |
return | resource | A new file resource with the decoded data. |
protected _transferEncode ( resource $fp, string $encoding ) : resource | ||
$fp | resource | A stream containing the data to encode. |
$encoding | string | The encoding to use. |
return | resource | A new file resource with the encoded data. |
protected _writeStream ( array $data, array $options = [] ) : resource | ||
$data | array | The data to write. Either a stream resource or a string. |
$options | array | Additional options: - error: (boolean) Catch errors when writing to the stream. Throw an ErrorException if an error is found. DEFAULT: false - filter: (array) Filter(s) to apply to the string. Keys are the filter names, values are filter params. - fp: (resource) Use this stream instead of creating a new one. |
return | resource | The stream resource. |
public addMimeHeaders ( array $options = [] ) : Horde_Mime_Headers | ||
$options | array | Additional options: - encode: (integer) A mask of allowable encodings. DEFAULT: Auto-determined - headers: (Horde_Mime_Headers) The object to add the MIME headers to. DEFAULT: Add headers to a new object |
return | Horde_Mime_Headers | A Horde_Mime_Headers object. |
public appendContents ( mixed $contents, $options = [] ) | ||
$contents | mixed | The part body. Either a string or a stream resource, or an array containing both. - encoding: (string) The encoding of $contents. DEFAULT: Current transfer encoding value. - usestream: (boolean) If $contents is a stream, should we directly use that stream? DEFAULT: $contents copied to a new stream. |
public buildMimeIds ( string $id = null, boolean $rfc822 = false ) | ||
$id | string | The ID of this part. |
$rfc822 | boolean | Is this a message/rfc822 part? |
public getAllContentTypeParameters ( ) : array | ||
return | array | An array of all the parameters Returns the empty array if no parameters set. |
public getAllDispositionParameters ( ) : array | ||
return | array | An array of all the parameters Returns the empty array if no parameters set. |
public getCharset ( ) : string | ||
return | string | The character set of this part (lowercase). Returns null if there is no character set. |
public getContentId ( ) : string | ||
return | string | The Content-ID for this part (null if not set). |
public getContentTypeParameter ( string $label ) : string | ||
$label | string | The content type parameter label. |
return | string | The data requested. Returns null if $label is not set. |
public getContents ( array $options = [] ) : mixed | ||
$options | array | Additional options:
- canonical: (boolean) Returns the contents in strict RFC 822 &
2045 output - namely, all newlines end with the
canonical |
return | mixed | The body text (string) of the part, null if there is no contents, and a stream resource if 'stream' is true. |
public getDefaultType ( ) : string | ||
return | string | The default MIME type of this part (ex.: text/plain). |
public getDescription ( boolean $default = false ) : string | ||
$default | boolean | If the description parameter doesn't exist, should we use the name of the part? |
return | string | The description of this part. |
public getDisposition ( ) : string | ||
return | string | The part's content-disposition. An empty string means no desired disposition has been set for this part. |
public getDispositionParameter ( string $label ) : string | ||
$label | string | The disposition parameter label. |
return | string | The data requested. Returns null if $label is not set. |
public getDuration ( ) : integer | ||
return | integer | The duration of the data, in seconds. Returns null if there is no duration information. |
public getHeaderCharset ( ) : string | ||
return | string | The character set. If no preferred character set has been set, returns null. |
public getMetadata ( string $key ) : mixed | ||
$key | string | The metadata key. |
return | mixed | The metadata, or null if it doesn't exist. |
public getPartByIndex ( $index ) : Horde_Mime_Part | ||
return | Horde_Mime_Part | Part, or null if not found. |
public getPrimaryType ( ) : string | ||
return | string | The primary MIME type of this part. |
public static getRawPartText ( mixed $text, string $type, string $id ) : string | ||
$text | mixed | The full text of the MIME message. The text is assumed to be MIME data (no MIME-Version checking is performed). It can be either a stream or a string. |
$type | string | Either 'header' or 'body'. |
$id | string | The MIME ID. |
return | string | The raw text. |
public getSubType ( ) : string | ||
return | string | The MIME subtype of this part. |
public isAttachment ( ) : boolean | ||
return | boolean | True if this part should be considered an attachment. |
public isBasePart ( boolean $base ) | ||
$base | boolean | True if this is the base MIME part. |
public static parseMessage ( string $text, array $opts = [] ) : Horde_Mime_Part | ||
$text | string | The text of the MIME message. |
$opts | array | Additional options: - forcemime: (boolean) If true, the message data is assumed to be MIME data. If not, a MIME-Version header must exist (RFC 2045 [4]) to be parsed as a MIME message. DEFAULT: false - level: (integer) Current nesting level of the MIME data. DEFAULT: 0 - no_body: (boolean) If true, don't set body contents of parts (since 2.2.0). DEFAULT: false |
return | Horde_Mime_Part | A MIME Part object. |
public partIterator ( boolean $current = true ) : Iterator | ||
$current | boolean | Include the current part as the base? |
return | Iterator | Recursive iterator. |
public replaceEOL ( mixed $text, string $eol = null, boolean $stream = false ) : string | ||
$text | mixed | The text to replace. Either a string or a stream resource. If a stream, and returning a string, will close the stream when done. |
$eol | string | The EOL sequence to use. If not present, uses the part's current EOL setting. |
$stream | boolean | If true, returns a stream resource. |
return | string | The text with the newlines replaced by the desired newline sequence (returned as a stream resource if $stream is true). |
public send ( string $email, Horde_Mime_Headers $headers, Horde_Mail_Transport $mailer, array $opts = [] ) | ||
string | The address list to send to. | |
$headers | Horde_Mime_Headers | The Horde_Mime_Headers object holding this message's headers. |
$mailer | Horde_Mail_Transport | A Horde_Mail_Transport object. |
$opts | array | Additional options:
- broken_rfc2231: (boolean) Attempt to work around non-RFC 2231-compliant MUAs by generating both a RFC 2047-like parameter name and also the correct RFC 2231 parameter (@since 2.5.0). DEFAULT: false - encode: (integer) The encoding to use. A mask of self::ENCODE_* values. DEFAULT: Auto-determined based on transport driver. |
public setCharset ( string $charset ) | ||
$charset | string | The character set of this part. |
public setContentId ( string $cid = null ) : string | ||
$cid | string | Use this CID (if not already set). Else, generate a random CID. |
return | string | The Content-ID for this part. |
public setContentTypeParameter ( string $label, string $data ) | ||
$label | string | The content-type parameter label. |
$data | string | The content-type parameter data. If null, removes the parameter (@since 2.8.0). |
public setContents ( mixed $contents, array $options = [] ) | ||
$contents | mixed | The part body. Either a string or a stream resource, or an array containing both. |
$options | array | Additional options: - encoding: (string) The encoding of $contents. DEFAULT: Current transfer encoding value. - usestream: (boolean) If $contents is a stream, should we directly use that stream? DEFAULT: $contents copied to a new stream. |
public setDescription ( string $description ) | ||
$description | string | The description of this part. If null, deletes the description (@since 2.8.0). |
public setDisposition ( string $disposition = null ) | ||
$disposition | string | The content-disposition to set ('inline', 'attachment', or an empty value). |
public setDispositionParameter ( string $label, string $data ) | ||
$label | string | The disposition parameter label. |
$data | string | The disposition parameter data. If null, removes the parameter (@since 2.8.0). |
public setDuration ( integer $duration ) | ||
$duration | integer | The duration of the data, in seconds. If null, clears the duration information. |
public setHeaderCharset ( string $charset ) | ||
$charset | string | The character set. |
public setLanguage ( mixed $lang ) | ||
$lang | mixed | A language string, or an array of language strings. |
public setMetadata ( string $key, mixed $data = null ) | ||
$key | string | The metadata key. |
$data | mixed | The metadata. If null, clears the key. |
public setTransferEncoding ( string $encoding, array $options = [] ) | ||
$encoding | string | The transfer encoding to use. |
$options | array | Additional options: - send: (boolean) If true, use $encoding as the sending encoding. DEFAULT: $encoding is used to change the base encoding. |
public toString ( array $options = [] ) : mixed | ||
$options | array | Additional options:
- canonical: (boolean) Returns the encoded part in strict RFC 822 &
2045 output - namely, all newlines end with the
canonical |
return | mixed | The MIME string (returned as a resource if $stream is true). |
public unserialize ( string $data ) | ||
$data | string | Serialized data. |
protected int $_bytes | ||
return | integer |
protected resource $_contents | ||
return | resource |
protected string $_eol | ||
return | string |
protected bool $_failed | ||
return | boolean |
protected string $_hdrCharset | ||
return | string |
protected Horde_Mime_Headers $_headers | ||
return | Horde_Mime_Headers |
protected string $_transferEncoding | ||
return | string |
public static string $defaultCharset | ||
return | string |
public static int $memoryLimit | ||
return | integer |