Provides common Message helper routines for Message manipulation.

author Zaahid Bateson
package MailMimeParser
inherited_from \ZBateson\MailMimeParser\Message\Helper\AbstractHelper

 Methods

Constructor

__construct(\ZBateson\MailMimeParser\Message\Part\Factory\MimePartFactory $mimePartFactory, \ZBateson\MailMimeParser\Message\Part\Factory\UUEncodedPartFactory $uuEncodedPartFactory, \ZBateson\MailMimeParser\Message\Part\Factory\PartBuilderFactory $partBuilderFactory) 
Inherited

Parameters

$mimePartFactory

\ZBateson\MailMimeParser\Message\Part\Factory\MimePartFactory

$uuEncodedPartFactory

\ZBateson\MailMimeParser\Message\Part\Factory\UUEncodedPartFactory

$partBuilderFactory

\ZBateson\MailMimeParser\Message\Part\Factory\PartBuilderFactory

Copies Content-* headers (permanent ones as defined in https://tools.ietf.org/html/rfc4021#section-2.2) from the $from header into the $to header. If the Content-Type header isn't defined in $from, defaults to text/plain with utf-8 and quoted-printable.

copyContentHeadersAndContent(\ZBateson\MailMimeParser\Message\Part\ParentHeaderPart $from, \ZBateson\MailMimeParser\Message\Part\ParentHeaderPart $to, boolean $move = false

Parameters

$from

\ZBateson\MailMimeParser\Message\Part\ParentHeaderPart

$to

\ZBateson\MailMimeParser\Message\Part\ParentHeaderPart

$move

boolean

Copies the passed $header from $from, to $to or sets the header to $default if it doesn't exist in $from.

copyHeader(\ZBateson\MailMimeParser\Message\Part\ParentHeaderPart $from, \ZBateson\MailMimeParser\Message\Part\ParentHeaderPart $to, string $header, string $default = null

Parameters

$from

\ZBateson\MailMimeParser\Message\Part\ParentHeaderPart

$to

\ZBateson\MailMimeParser\Message\Part\ParentHeaderPart

$header

string

$default

string

Creates a new content part from the passed part, allowing the part to be used for something else (e.g. changing a non-mime message to a multipart mime message).

createNewContentPartFrom(\ZBateson\MailMimeParser\Message\Part\ParentHeaderPart $part) : \ZBateson\MailMimeParser\Message\Part\MimePart

Parameters

$part

\ZBateson\MailMimeParser\Message\Part\ParentHeaderPart

Returns

\ZBateson\MailMimeParser\Message\Part\MimePartthe newly-created MimePart

Copies type headers (Content-Type, Content-Disposition, Content-Transfer-Encoding) from the $from MimePart to $to. Attaches the content resource handle of $from to $to, and loops over child parts, removing them from $from and adding them to $to.

movePartContentAndChildren(\ZBateson\MailMimeParser\Message\Part\ParentHeaderPart $from, \ZBateson\MailMimeParser\Message\Part\ParentHeaderPart $to) 

Parameters

$from

\ZBateson\MailMimeParser\Message\Part\ParentHeaderPart

$to

\ZBateson\MailMimeParser\Message\Part\ParentHeaderPart

Removes Content-* headers (permanent ones as defined in https://tools.ietf.org/html/rfc4021#section-2.2) from the passed part, then detaches its content stream.

removeContentHeadersAndContent(\ZBateson\MailMimeParser\Message\Part\ParentHeaderPart $part) 

Parameters

$part

\ZBateson\MailMimeParser\Message\Part\ParentHeaderPart

Replaces the $part ParentHeaderPart with $replacement.

replacePart(\ZBateson\MailMimeParser\Message $message, \ZBateson\MailMimeParser\Message\Part\ParentHeaderPart $part, \ZBateson\MailMimeParser\Message\Part\ParentHeaderPart $replacement) 

Essentially removes $part from its parent, and adds $replacement in its same position. If $part is this Message, then $part can't be removed and replaced, and instead $replacement's type headers are copied to $message, and any children below $replacement are added directly below $message.

Parameters

$message

\ZBateson\MailMimeParser\Message

$part

\ZBateson\MailMimeParser\Message\Part\ParentHeaderPart

$replacement

\ZBateson\MailMimeParser\Message\Part\ParentHeaderPart

 Properties

 

to create parts for attachments/content

$mimePartFactory : \ZBateson\MailMimeParser\Message\Part\Factory\MimePartFactory

Default

 

to create parts for attachments/content

$partBuilderFactory : \ZBateson\MailMimeParser\Message\Part\Factory\PartBuilderFactory

Default

 

to create parts for attachments

$uuEncodedPartFactory : \ZBateson\MailMimeParser\Message\Part\Factory\UUEncodedPartFactory

Default

 

List of content headers grabbed from <a href="https://tools.ietf.org/html/rfc4021#section-2.2">https://tools.ietf.org/html/rfc4021#section-2.2</a>

$contentHeaders : array<mixed,string>

Default

array('Content-Type', 'Content-Transfer-Encoding', 'Content-Disposition', 'Content-ID', 'Content-Description', 'Content-Language', 'Content-Base', 'Content-Location', 'Content-features', 'Content-Alternative', 'Content-MD5', 'Content-Duration')
Static