rcube_mime

Class for parsing MIME messages

package

Framework

subpackage

Storage

author

Thomas Bruederli roundcube@gmail.com

author

Aleksander Machniak alec@alec.pl

Methods

Object constructor.

__construct( $default_charset = null) 

Arguments

$default_charset

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 an address list into a structured array list

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

Arguments

$input

string

Input string

$max

integer

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

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, boolean $remove_comments = false) : array
static

Arguments

$separator

string

String containing separator characters

$str

string

Header string

$remove_comments

boolean

Enable to remove comments

Response

array

Header items

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 till@php.net

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

Try to fix invalid email addresses

fix_email( $email) 
static

Arguments

$email

Wrap the given text to comply with RFC 2646

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

Arguments

$text

string

Text to wrap

$length

integer

Length

$charset

string

Character encoding of $text

Response

string

Wrapped text

Returns message/object character set name

get_charset() : string
static

Response

string

Characted set name

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

E-mail address list parser

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

Arguments

$str

$decode

$fallback

Split RFC822 header string into an associative array

parse_headers( $headers) 
static

Arguments

$headers

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

parse_message(string $raw_body) : object
static

It makes use of the rcube_mime_decode library

Arguments

$raw_body

string

The message source

Response

object

rcube_message_part The message structure

Interpret a format=flowed message body according to RFC 2646

unfold_flowed(string $text, string $mark = null) : string
static

Arguments

$text

string

Raw body formatted as flowed text

$mark

string

Mark each flowed line with specified character

Response

string

Interpreted text with unwrapped lines and stuffed space removed

Improved wordwrap function with multibyte support.

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

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

Arguments

$string

string

Text to wrap

$width

integer

Line width

$break

string

Line separator

$cut

boolean

Enable to cut word

$charset

string

Charset of $string

$wrap_quoted

boolean

When enabled quoted lines will not be wrapped

Response

string

Text

Properties

default_charset

default_charset : 
static

Type(s)