rcube_mime_decode

Class for parsing MIME messages

package

Framework

subpackage

Storage

author

Aleksander Machniak alec@alec.pl

Methods

Constructor.

__construct(array $params = array()) 

Sets up the object, initialise the variables, and splits and stores the header and body of the input.

Arguments

$params

array

An array of various parameters that determine various things: include_bodies - Whether to include the body in the returned object. decode_bodies - Whether to decode the bodies of the parts. (Transfer encoding) decode_headers - Whether to decode headers crlf - CRLF type to use (CRLF/LF/CR)

This function splits the input based on the given boundary

boundarySplit(string $input, string $boundary) : array

Arguments

$input

string

Input to parse

$boundary

string

Boundary

Response

array

Contains array of resulting mime parts

Performs the decoding process.

decode(string $input, boolean $convert = true) : object|boolean

Arguments

$input

string

The input to decode

$convert

boolean

Convert result to rcube_message_part structure

Response

object|boolean

Decoded results or False on failure

Given a header, this function will decode it according to RFC2047.

decodeHeader(string $input) : string

Probably not exactly conformant, but it does pass all the given examples (in RFC2047).

Arguments

$input

string

Input header value to decode

Response

string

Decoded header value

Performs the decoding. Decodes the body string passed to it If it finds certain content-types it will call itself in a recursive fashion

do_decode(string $headers, string $body, string $default_ctype = 'text/plain') : object|boolean

Arguments

$headers

string

Header section

$body

string

Body section

$default_ctype

string

Default content type

Response

object|boolean

Decoded results or False on error

Parse headers given in $input and return as assoc array.

parseHeaders(string $input) : array

Arguments

$input

string

Headers to parse

Response

array

Contains parsed headers

Function to parse a header value, extract first part, and any secondary parts (after ;) This function is not as robust as it could be.

parseHeaderValue(string $input) : array

Eg. header comments in the wrong place will probably break it.

Arguments

$input

string

Header value to parse

Response

array

Contains parsed result

Given a string containing a header and body section, this function will split them (at the first blank line) and return them.

splitBodyHeader(string $input) : array

Arguments

$input

string

Input to split apart

Response

array

Contains header and body section

Recursive method to convert a rcube_mime_decode structure into a rcube_message_part object.

structure_part(object $part, integer $count, string $parent = '') : object
see \rcube_mime_decode::decode()

Arguments

$part

object

A message part struct

$count

integer

Part count

$parent

string

Parent MIME ID

Response

object

rcube_message_part

Properties

Class configuration parameters.

params : array
var

Type(s)

array