Documentation

Message extends AbstractMessage
in package

Message class

Tags
category

Pop

author

Nick Sagona, III dev@nolainteractive.com

copyright

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

license

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

version
3.6.0

Table of Contents

CRLF  = "\r\n"
Message newline constant
$addresses  : array<string|int, mixed>
Message addresses
$boundary  : string
Message boundary
$charSet  : string
Character set
$contentType  : string
Content type
$headers  : array<string|int, mixed>
Headers
$id  : string
Message or part ID
$idHeader  : string
Message or part ID header name
$parts  : array<string|int, mixed>
Message parts
__clone()  : void
Perform a "deep" clone of a message object
__construct()  : mixed
Constructor
__toString()  : string
Render message to string
addHeader()  : AbstractMessage
Add message part header
addHeaders()  : AbstractMessage
Add message part headers
addHtml()  : Message
Add HTML message part
addPart()  : Message
Add message part
addText()  : Message
Add text message part
attachFile()  : Message
Attach file message part
attachFileFromStream()  : Message
Attach file message part from stream
decodeText()  : string
Decode text
generateBoundary()  : Message
Generate message MIME boundary
generateId()  : string
Generate a new ID
getBcc()  : array<string|int, mixed>
Get BCC
getBody()  : string
Get message body
getBoundary()  : string
Get message MIME boundary
getCc()  : array<string|int, mixed>
Get CC
getCharSet()  : string
Get message part character set
getContentType()  : string
Get message part content type
getFrom()  : array<string|int, mixed>
Get From
getHeader()  : string
Get message part header
getHeaderAsString()  : string
Get header as string
getHeaders()  : array<string|int, mixed>
Get all message part headers
getHeadersAsString()  : string
Get all message headers as string
getId()  : string
Get the ID
getIdHeader()  : string
Get the ID
getPart()  : PartInterface
Get message part
getParts()  : array<string|int, mixed>
Get message parts
getReplyTo()  : array<string|int, mixed>
Get Reply-To
getReturnPath()  : array<string|int, mixed>
Get Return-Path
getSender()  : array<string|int, mixed>
Get Sender
getSubject()  : string
Get subject
getTo()  : array<string|int, mixed>
Get To
hasHeader()  : bool
Determine if message part has header
load()  : Message
Load a message from a string source or file on disk
parse()  : Message
Parse message from string
parseAddresses()  : string
Parse addresses
parseFromFile()  : Message
Parse message from file
parseNameAndEmail()  : array<string|int, mixed>
Parse a name and email from an address string
removeHeader()  : Message
Remove header
render()  : string
Render message
renderAsLines()  : array<string|int, mixed>
Render as an array of lines
save()  : void
Save message to file on disk
setBcc()  : AbstractMessage
Set BCC
setBody()  : Message
Set body
setBoundary()  : Message
Set message MIME boundary
setCc()  : AbstractMessage
Set CC
setCharSet()  : AbstractMessage
Set message part character set
setContentType()  : AbstractMessage
Set message part content type
setFrom()  : AbstractMessage
Set From
setId()  : AbstractMessage
Set the ID
setIdHeader()  : AbstractMessage
Set the ID header name
setReplyTo()  : AbstractMessage
Set Reply-To
setReturnPath()  : AbstractMessage
Set Return-Path
setSender()  : AbstractMessage
Set Sender
setSubject()  : AbstractMessage
Set Subject
setTo()  : AbstractMessage
Set To
toByteStream()  : mixed
Write this entire entity to a buffer
getRandomId()  : string
Returns a random ID
validateContentType()  : void
Validate content type based on message parts added to the message

Constants

CRLF

Message newline constant

public string CRLF = "\r\n"

Properties

$addresses

Message addresses

protected array<string|int, mixed> $addresses = ['To' => [], 'CC' => [], 'BCC' => [], 'From' => [], 'Reply-To' => [], 'Sender' => [], 'Return-Path' => []]

$boundary

Message boundary

protected string $boundary = null

$idHeader

Message or part ID header name

protected string $idHeader = null

$parts

Message parts

protected array<string|int, mixed> $parts = []

Methods

__clone()

Perform a "deep" clone of a message object

public __clone() : void
Return values
void

__construct()

Constructor

public __construct([string $subject = null ]) : mixed

Instantiate the message object

Parameters
$subject : string = null
Return values
mixed

__toString()

Render message to string

public __toString() : string
Return values
string

addHtml()

Add HTML message part

public addHtml(mixed $html) : Message
Parameters
$html : mixed
Return values
Message

addText()

Add text message part

public addText(mixed $text) : Message
Parameters
$text : mixed
Return values
Message

attachFile()

Attach file message part

public attachFile(string $file[, string $encoding = AbstractPart::BASE64 ]) : Message
Parameters
$file : string
$encoding : string = AbstractPart::BASE64
Return values
Message

attachFileFromStream()

Attach file message part from stream

public attachFileFromStream(string $stream[, string $basename = 'file.tmp' ][, string $encoding = AbstractPart::BASE64 ]) : Message
Parameters
$stream : string
$basename : string = 'file.tmp'
$encoding : string = AbstractPart::BASE64
Return values
Message

decodeText()

Decode text

public static decodeText(string $text) : string
Parameters
$text : string
Return values
string

generateBoundary()

Generate message MIME boundary

public generateBoundary() : Message
Return values
Message

generateId()

Generate a new ID

public generateId() : string
Return values
string

getBcc()

Get BCC

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

getBody()

Get message body

public getBody() : string
Return values
string

getBoundary()

Get message MIME boundary

public getBoundary() : string
Return values
string

getCc()

Get CC

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

getCharSet()

Get message part character set

public getCharSet() : string
Return values
string

getContentType()

Get message part content type

public getContentType() : string
Return values
string

getFrom()

Get From

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

getHeader()

Get message part header

public getHeader(string $header) : string
Parameters
$header : string
Return values
string

getHeaderAsString()

Get header as string

public getHeaderAsString(string $header) : string
Parameters
$header : string
Return values
string

getHeaders()

Get all message part headers

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

getHeadersAsString()

Get all message headers as string

public getHeadersAsString([array<string|int, mixed> $omitHeaders = [] ]) : string
Parameters
$omitHeaders : array<string|int, mixed> = []
Return values
string

getId()

Get the ID

public getId() : string
Return values
string

getIdHeader()

Get the ID

public getIdHeader() : string
Return values
string

getParts()

Get message parts

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

getReplyTo()

Get Reply-To

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

getReturnPath()

Get Return-Path

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

getSender()

Get Sender

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

getSubject()

Get subject

public getSubject() : string
Return values
string

getTo()

Get To

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

hasHeader()

Determine if message part has header

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

load()

Load a message from a string source or file on disk

public static load(string $message) : Message
Parameters
$message : string
Tags
throws
Exception
Return values
Message

parse()

Parse message from string

public static parse(string $stream) : Message
Parameters
$stream : string
Tags
throws
Exception
Return values
Message

parseAddresses()

Parse addresses

public parseAddresses(mixed $addresses[, bool $asArray = false ]) : string
Parameters
$addresses : mixed
$asArray : bool = false
Return values
string

parseFromFile()

Parse message from file

public static parseFromFile(string $file) : Message
Parameters
$file : string
Tags
throws
Exception
Return values
Message

parseNameAndEmail()

Parse a name and email from an address string

public parseNameAndEmail(string $address) : array<string|int, mixed>
Parameters
$address : string
Return values
array<string|int, mixed>

removeHeader()

Remove header

public removeHeader(string $header) : Message
Parameters
$header : string
Return values
Message

render()

Render message

public render([array<string|int, mixed> $omitHeaders = [] ]) : string
Parameters
$omitHeaders : array<string|int, mixed> = []
Return values
string

renderAsLines()

Render as an array of lines

public renderAsLines([array<string|int, mixed> $omitHeaders = [] ]) : array<string|int, mixed>
Parameters
$omitHeaders : array<string|int, mixed> = []
Return values
array<string|int, mixed>

save()

Save message to file on disk

public save(string $to[, array<string|int, mixed> $omitHeaders = [] ]) : void
Parameters
$to : string
$omitHeaders : array<string|int, mixed> = []
Return values
void

setBody()

Set body

public setBody(mixed $body) : Message
Parameters
$body : mixed
Return values
Message

setBoundary()

Set message MIME boundary

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

toByteStream()

Write this entire entity to a buffer

public toByteStream(BufferInterface $is[, array<string|int, mixed> $omitHeaders = [] ]) : mixed
Parameters
$is : BufferInterface
$omitHeaders : array<string|int, mixed> = []
Return values
mixed

getRandomId()

Returns a random ID

protected getRandomId() : string
Return values
string

validateContentType()

Validate content type based on message parts added to the message

protected validateContentType() : void
Return values
void

Search results