rcube_mime

Class for parsing MIME messages

package

Framework

subpackage

Storage

author

Thomas Bruederli

author

Aleksander Machniak

Methods

Object constructor.

__construct($default_charset = null) 

Arguments

$default_charset

Returns message/object character set name

get_charset() : string
static

Response

string

Characted set name

Parse the given raw message source and return a structure of rcube_message_part objects.

parse_message($raw_body) : object
static

It makes use of the PEAR:Mail_mimeDecode library

Arguments

$raw_body

Response

object

rcube_message_part The message structure

Recursive method to convert a Mail_mimeDecode part into a rcube_message_part object

structure_part($part, $count, $parent = '') : object
static

Arguments

$part

$count

$parent

Response

object

rcube_message_part

Split an address list into a structured array list

decode_address_list(string $input, int $max = null, boolean $decode = true, string $fallback = null, boolean $addronly = false) : array
static

Arguments

$input

string

Input string

$max

int

List only this number of addresses

$decode

boolean

Decode address strings

$fallback

string

Fallback charset if none specified

$addronly

boolean

Return flat array with e-mail addresses only

Response

array

Indexed list of addresses

Decode a message header value

decode_header(string $input, string $fallback = null) : string
static

Arguments

$input

string

Header value

$fallback

string

Fallback charset if none specified

Response

string

Decoded string

Decode a mime-encoded string to internal charset

decode_mime_string(string $input, string $fallback = null) : string
static

Arguments

$input

string

Header value

$fallback

string

Fallback charset if none specified

Response

string

Decoded string

Decode a mime part

decode(string $input, string $encoding = '7bit') : string
static

Arguments

$input

string

Input string

$encoding

string

Part encoding

Response

string

Decoded string

Split RFC822 header string into an associative array

parse_headers($headers) 
static
access

private

Arguments

$headers

parse_address_list

parse_address_list($str, $decode = true, $fallback = null) 
static
access

private

Arguments

$str

$decode

$fallback

Explodes header (e.g. address-list) string into array of strings using specified separator characters with proper handling of quoted-strings and comments (RFC2822)

explode_header_string(string $separator, string $str, bool $remove_comments = false) : array
static

Arguments

$separator

string

String containing separator characters

$str

string

Header string

$remove_comments

bool

Enable to remove comments

Response

array

Header items

Interpret a format=flowed message body according to RFC 2646

unfold_flowed(string $text) : string
static

Arguments

$text

string

Raw body formatted as flowed text

Response

string

Interpreted text with unwrapped lines and stuffed space removed

Wrap the given text to comply with RFC 2646

format_flowed(string $text, int $length = 72, string $charset = null) : string
static

Arguments

$text

string

Text to wrap

$length

int

Length

$charset

string

Character encoding of $text

Response

string

Wrapped text

Improved wordwrap function with multibyte support.

wordwrap(string $string, int $width = 75, string $break = "\n", bool $cut = false, string $charset = null, bool $wrap_quoted = true) : string
static

The code is based on Zend_Text_MultiByte::wordWrap().

Arguments

$string

string

Text to wrap

$width

int

Line width

$break

string

Line separator

$cut

bool

Enable to cut word

$charset

string

Charset of $string

$wrap_quoted

bool

When enabled quoted lines will not be wrapped

Response

string

Text

A method to guess the mime_type of an attachment.

file_content_type(string $path, string $name, string $failover = 'application/octet-stream', boolean $is_stream = false, boolean $skip_suffix = false) : string
static
author

Till Klampaeckel

see \http://de2.php.net/manual/en/ref.fileinfo.php \http://de2.php.net/mime_content_type

Arguments

$path

string

Path to the file or file contents

$name

string

File name (with suffix)

$failover

string

Mime type supplied for failover

$is_stream

boolean

Set to True if $path contains file contents

$skip_suffix

boolean

Set to True if the config/mimetypes.php mappig should be ignored

Response

string

Get mimetype => file extension mapping

get_mime_extensions($mimetype = null) : array
static

Arguments

$mimetype

Response

array

List of extensions matching the given mimetype or a hash array with ext -> mimetype mappings if $mimetype is not given

Detect image type of the given binary data by checking magic numbers.

image_content_type(string $data) : string
static

Arguments

$data

string

Binary file content

Response

string

Detected mime-type or jpeg as fallback

Properties

default_charset

default_charset : 
static