MailMimeParser 1.1

MimePart extends ParentHeaderPart

Represents a single part of a multi-part mime message.

A MimePart object may have any number of child parts, or may be a child itself with its own parent or parents.

The content of the part can be read from its PartStream resource handle, accessible via MessagePart::getContentResourceHandle.

Tags
author

Zaahid Bateson

Table of Contents

getCharset()  : string
Returns the upper-cased charset of the Content-Type header's charset parameter if set, ISO-8859-1 if the Content-Type is text/plain or text/html and the charset parameter isn't set, or null otherwise.
getContentDisposition()  : string
Returns the content's disposition, defaulting to 'inline' if not set.
getContentId()  : string|null
Returns the Content ID of the part.
getContentTransferEncoding()  : string
Returns the content-transfer-encoding used for this part, defaulting to '7bit' if not set.
getContentType()  : string
Returns the lower-cased, trimmed value of the Content-Type header.
getFilename()  : string
Returns a filename for the part if one is defined, or null otherwise.
getPartByContentId()  : MessagePart
Convenience method to find a part by its Content-ID header.
isMime()  : bool
Returns true.
isMultiPart()  : bool
Returns true if this part's mime type is multipart/*
isTextPart()  : bool
Returns true if this part's mime type is text/plain, text/html or if the Content-Type header defines a charset.

Methods

getCharset()

Returns the upper-cased charset of the Content-Type header's charset parameter if set, ISO-8859-1 if the Content-Type is text/plain or text/html and the charset parameter isn't set, or null otherwise.

public getCharset() : string

If the charset parameter is set to 'binary' it is ignored and considered 'not set' (returns ISO-8859-1 for text/plain, text/html or null otherwise).

Return values
string

getContentDisposition()

Returns the content's disposition, defaulting to 'inline' if not set.

public getContentDisposition([string $default = 'inline' ]) : string
Parameters
$default : string = 'inline'

pass to override the default returned disposition when not set.

Return values
string

getContentId()

Returns the Content ID of the part.

public getContentId() : string|null

In MimePart, this is merely a shortcut to calling $part->getHeaderValue('Content-ID');.

Return values
string|null

getContentTransferEncoding()

Returns the content-transfer-encoding used for this part, defaulting to '7bit' if not set.

public getContentTransferEncoding([string $default = '7bit' ]) : string
Parameters
$default : string = '7bit'

pass to override the default when not set.

Return values
string

getContentType()

Returns the lower-cased, trimmed value of the Content-Type header.

public getContentType([string $default = 'text/plain' ]) : string

Parses the Content-Type header, defaults to returning text/plain if not defined.

Parameters
$default : string = 'text/plain'

pass to override the returned value when not set

Return values
string

getFilename()

Returns a filename for the part if one is defined, or null otherwise.

public getFilename() : string
Return values
string

getPartByContentId()

Convenience method to find a part by its Content-ID header.

public getPartByContentId(string $contentId) : MessagePart
Parameters
$contentId : string
Return values
MessagePart

isMime()

Returns true.

public isMime() : bool
Return values
bool

isMultiPart()

Returns true if this part's mime type is multipart/*

public isMultiPart() : bool
Return values
bool

isTextPart()

Returns true if this part's mime type is text/plain, text/html or if the Content-Type header defines a charset.

public isTextPart() : bool
Return values
bool

Search results