Documentation

Part
in package

MIME message part class

Tags
category

Pop

author

Nick Sagona, III dev@nolainteractive.com

copyright

Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com)

license

http://www.popphp.org/license New BSD License

version
2.0.0

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
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
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

$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
string

addFile()

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
throws
Exception
Return values
Part

addHeader()

Add a header

public addHeader(Header|string $header[, string|null $value = null ]) : Part
Parameters
$header : Header|string
$value : string|null = null
Return values
Part

addHeaders()

Add headers

public addHeaders(array<string|int, mixed> $headers) : Part
Parameters
$headers : array<string|int, mixed>
Return values
Part

addPart()

Add a nested part

public addPart(Part $part) : Part
Parameters
$part : Part
Return values
Part

addParts()

Add nested parts

public addParts(array<string|int, mixed> $parts) : Part
Parameters
$parts : array<string|int, mixed>
Return values
Part

generateBoundary()

Generate boundary

public generateBoundary() : string
Return values
string

getAttachments()

Get attachments

public getAttachments() : array<string|int, mixed>
Return values
array<string|int, mixed>

getBoundary()

Get boundary

public getBoundary() : string
Return values
string

getContents()

Get contents (decoded)

public getContents() : mixed

getContentType()

Get content-type

public getContentType() : string
Return values
string

getFilename()

Get attachment filename

public getFilename() : string|null
Return values
string|null

getHeader()

Get headers

public getHeader(string $name) : Header|null
Parameters
$name : string
Return values
Header|null

getHeaders()

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
string

hasAttachment()

Has attachment (check via a header)

public hasAttachment() : bool
Return values
bool

hasAttachments()

Does message have attachments (check via parts)

public hasAttachments() : bool
Return values
bool

hasBody()

Has body

public hasBody() : bool
Return values
bool

hasBoundary()

Has boundary

public hasBoundary() : bool
Return values
bool

hasHeader()

Has header

public hasHeader(string $name) : bool
Parameters
$name : string
Return values
bool

hasHeaders()

Has headers

public hasHeaders() : bool
Return values
bool

hasParts()

Has nested parts

public hasParts() : bool
Return values
bool

hasSubType()

Has subtype

public hasSubType() : bool
Return values
bool

removeHeader()

Remove header

public removeHeader(string $name) : Part
Parameters
$name : string
Return values
Part

render()

Render the part

public render([bool $preamble = true ]) : string
Parameters
$preamble : bool = true
Return values
string

renderBody()

Render the part body

public renderBody() : string
Return values
string

renderHeaders()

Render the part headers

public renderHeaders() : string
Return values
string

renderParts()

Render the parts

public renderParts([bool $preamble = true ][, bool $headers = true ]) : string
Parameters
$preamble : bool = true
$headers : bool = true
Return values
string

renderRaw()

Render the part raw (no headers or preamble)

public renderRaw() : string
Return values
string

setBody()

Set body

public setBody(Body|string $body) : Part
Parameters
$body : Body|string
Return values
Part

setBoundary()

Set boundary

public setBoundary(string $boundary) : Part
Parameters
$boundary : string
Return values
Part

setSubType()

Set subtype

public setSubType(string $subType) : Part
Parameters
$subType : string
Return values
Part

        
On this page

Search results