Message
extends Part
in package
MIME message class
Tags
Table of Contents
Properties
- $body : Body|null
- Body
- $boundary : string|null
- Boundary
- $headers : array<string|int, mixed>
- Headers
- $parts : array<string|int, mixed>
- Nested parts
- $subType : string|null
- Subtype
Methods
- __construct() : mixed
- Constructor
- __toString() : string
- Render the part
- addFile() : Part
- Add file as body
- addHeader() : Part
- Add a header
- addHeaders() : Part
- Add headers
- addPart() : Part
- Add a nested part
- addParts() : Part
- Add nested parts
- createForm() : Message
- Create multipart form object
- generateBoundary() : string
- Generate boundary
- getAttachments() : array<string|int, mixed>
- Get attachments
- getBody() : Body
- Get body
- getBoundary() : string
- Get boundary
- getContents() : mixed
- Get contents (decoded)
- getContentType() : string
- Get content-type
- getFilename() : string|null
- Get attachment filename
- getHeader() : Header|null
- Get headers
- getHeaders() : array<string|int, mixed>
- Get headers
- getHeadersAsArray() : array<string|int, mixed>
- Get headers as array
- getParts() : array<string|int, mixed>
- Get nested parts
- getSubType() : string
- Get subtype
- hasAttachment() : bool
- Has attachment (check via a header)
- hasAttachments() : bool
- Does message have attachments (check via parts)
- hasBody() : bool
- Has body
- hasBoundary() : bool
- Has boundary
- hasHeader() : bool
- Has header
- hasHeaders() : bool
- Has headers
- hasParts() : bool
- Has nested parts
- hasSubType() : bool
- Has subtype
- parseBody() : array<string|int, mixed>
- Parse message body string
- parseForm() : array<string|int, mixed>
- Parse form data
- parseHeaders() : array<string|int, mixed>
- Parse message header string
- parseMessage() : Message
- Parse message
- parsePart() : Part|array<string|int, mixed>
- Parse message part string
- removeHeader() : Part
- Remove header
- render() : string
- Render the part
- renderBody() : string
- Render the part body
- renderHeaders() : string
- Render the part headers
- renderParts() : string
- Render the parts
- renderRaw() : string
- Render the part raw (no headers or preamble)
- setBody() : Part
- Set body
- setBoundary() : Part
- Set boundary
- setSubType() : Part
- Set subtype
Properties
$body
Body
protected
Body|null
$body
= null
$boundary
Boundary
protected
string|null
$boundary
= null
$headers
Headers
protected
array<string|int, mixed>
$headers
= []
$parts
Nested parts
protected
array<string|int, mixed>
$parts
= []
$subType
Subtype
protected
string|null
$subType
= null
Methods
__construct()
Constructor
public
__construct() : mixed
Instantiate the mime part object
__toString()
Render the part
public
__toString() : string
Return values
stringaddFile()
Add file as body
public
addFile(string $file[, string $disposition = 'attachment' ][, string $encoding = PartBody::BASE64 ][, int|bool $split = true ]) : Part
Parameters
- $file : string
- $disposition : string = 'attachment'
- $encoding : string = PartBody::BASE64
- $split : int|bool = true
Tags
Return values
PartaddHeader()
Add a header
public
addHeader(Header|string $header[, string|null $value = null ]) : Part
Parameters
- $header : Header|string
- $value : string|null = null
Return values
PartaddHeaders()
Add headers
public
addHeaders(array<string|int, mixed> $headers) : Part
Parameters
- $headers : array<string|int, mixed>
Return values
PartaddPart()
Add a nested part
public
addPart(Part $part) : Part
Parameters
- $part : Part
Return values
PartaddParts()
Add nested parts
public
addParts(array<string|int, mixed> $parts) : Part
Parameters
- $parts : array<string|int, mixed>
Return values
PartcreateForm()
Create multipart form object
public
static createForm([array<string|int, mixed> $fields = [] ]) : Message
Parameters
- $fields : array<string|int, mixed> = []
Return values
MessagegenerateBoundary()
Generate boundary
public
generateBoundary() : string
Return values
stringgetAttachments()
Get attachments
public
getAttachments() : array<string|int, mixed>
Return values
array<string|int, mixed>getBody()
Get body
public
getBody() : Body
Return values
BodygetBoundary()
Get boundary
public
getBoundary() : string
Return values
stringgetContents()
Get contents (decoded)
public
getContents() : mixed
getContentType()
Get content-type
public
getContentType() : string
Return values
stringgetFilename()
Get attachment filename
public
getFilename() : string|null
Return values
string|nullgetHeader()
Get headers
public
getHeader(string $name) : Header|null
Parameters
- $name : string
Return values
Header|nullgetHeaders()
Get headers
public
getHeaders() : array<string|int, mixed>
Return values
array<string|int, mixed>getHeadersAsArray()
Get headers as array
public
getHeadersAsArray() : array<string|int, mixed>
Return values
array<string|int, mixed>getParts()
Get nested parts
public
getParts() : array<string|int, mixed>
Return values
array<string|int, mixed>getSubType()
Get subtype
public
getSubType() : string
Return values
stringhasAttachment()
Has attachment (check via a header)
public
hasAttachment() : bool
Return values
boolhasAttachments()
Does message have attachments (check via parts)
public
hasAttachments() : bool
Return values
boolhasBody()
Has body
public
hasBody() : bool
Return values
boolhasBoundary()
Has boundary
public
hasBoundary() : bool
Return values
boolhasHeader()
Has header
public
hasHeader(string $name) : bool
Parameters
- $name : string
Return values
boolhasHeaders()
Has headers
public
hasHeaders() : bool
Return values
boolhasParts()
Has nested parts
public
hasParts() : bool
Return values
boolhasSubType()
Has subtype
public
hasSubType() : bool
Return values
boolparseBody()
Parse message body string
public
static parseBody(string $bodyString[, string|null $boundary = null ]) : array<string|int, mixed>
Parameters
- $bodyString : string
- $boundary : string|null = null
Return values
array<string|int, mixed>parseForm()
Parse form data
public
static parseForm(string $formString) : array<string|int, mixed>
Parameters
- $formString : string
Return values
array<string|int, mixed>parseHeaders()
Parse message header string
public
static parseHeaders(string $headerString) : array<string|int, mixed>
Parameters
- $headerString : string
Return values
array<string|int, mixed>parseMessage()
Parse message
public
static parseMessage(string $messageString) : Message
Parameters
- $messageString : string
Return values
MessageparsePart()
Parse message part string
public
static parsePart(string $partString) : Part|array<string|int, mixed>
Parameters
- $partString : string
Return values
Part|array<string|int, mixed>removeHeader()
Remove header
public
removeHeader(string $name) : Part
Parameters
- $name : string
Return values
Partrender()
Render the part
public
render([bool $preamble = true ]) : string
Parameters
- $preamble : bool = true
Return values
stringrenderBody()
Render the part body
public
renderBody() : string
Return values
stringrenderHeaders()
Render the part headers
public
renderHeaders() : string
Return values
stringrenderParts()
Render the parts
public
renderParts([bool $preamble = true ][, bool $headers = true ]) : string
Parameters
- $preamble : bool = true
- $headers : bool = true
Return values
stringrenderRaw()
Render the part raw (no headers or preamble)
public
renderRaw() : string
Return values
stringsetBody()
Set body
public
setBody(Body|string $body) : Part
Parameters
- $body : Body|string
Return values
PartsetBoundary()
Set boundary
public
setBoundary(string $boundary) : Part
Parameters
- $boundary : string
Return values
PartsetSubType()
Set subtype
public
setSubType(string $subType) : Part
Parameters
- $subType : string