Message
extends AbstractMessage
in package
Message class
Tags
Table of Contents
Constants
- CRLF = "\r\n"
- Message newline constant
Properties
- $addresses : array<string|int, mixed>
- Message addresses
- $boundary : string|null
- Message boundary
- $charSet : string|null
- Character set
- $contentType : string|null
- Content type
- $headers : array<string|int, mixed>
- Headers
- $id : string|null
- Message or part ID
- $idHeader : string|null
- Message or part ID header name
- $parts : array<string|int, mixed>
- Message parts
Methods
- __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|null
- Get message body
- getBoundary() : string
- Get message MIME boundary
- getCc() : array<string|int, mixed>
- Get CC
- getCharSet() : string|null
- Get message part character set
- getContentType() : string|null
- Get message part content type
- getFrom() : array<string|int, mixed>
- Get From
- getHeader() : string|null
- Get message part header
- getHeaderAsString() : string|null
- Get header as string
- getHeaders() : array<string|int, mixed>
- Get all message part headers
- getHeadersAsString() : string
- Get all message headers as string
- getId() : string|null
- Get the ID
- getIdHeader() : string|null
- Get the ID
- getPart() : PartInterface|null
- 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|null
- Get subject
- getTo() : array<string|int, mixed>
- Get To
- hasAttachments() : bool
- Has attachments
- hasBcc() : bool
- Has BCC
- hasCc() : bool
- Has CC
- hasFrom() : bool
- Has From
- hasHeader() : bool
- Determine if message part has header
- hasReplyTo() : bool
- Has Reply-To
- hasReturnPath() : bool
- Has Return-Path
- hasSender() : bool
- Has Sender
- hasTo() : bool
- Has To
- load() : Message
- Load a message from a string source or file on disk
- parse() : Message
- Parse message from string
- parseAddresses() : string|array<string|int, mixed>
- 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() : void
- 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|null
$boundary
= null
$charSet
Character set
protected
string|null
$charSet
= null
$contentType
Content type
protected
string|null
$contentType
= null
$headers
Headers
protected
array<string|int, mixed>
$headers
= []
$id
Message or part ID
protected
string|null
$id
= null
$idHeader
Message or part ID header name
protected
string|null
$idHeader
= null
$parts
Message parts
protected
array<string|int, mixed>
$parts
= []
Methods
__clone()
Perform a "deep" clone of a message object
public
__clone() : void
__construct()
Constructor
public
__construct([string|null $subject = null ]) : mixed
Instantiate the message object
Parameters
- $subject : string|null = null
__toString()
Render message to string
public
__toString() : string
Return values
stringaddHeader()
Add message part header
public
addHeader(string $header, string $value) : AbstractMessage
Parameters
- $header : string
- $value : string
Return values
AbstractMessageaddHeaders()
Add message part headers
public
addHeaders(array<string|int, mixed> $headers) : AbstractMessage
Parameters
- $headers : array<string|int, mixed>
Return values
AbstractMessageaddHtml()
Add HTML message part
public
addHtml(mixed $html) : Message
Parameters
- $html : mixed
Return values
MessageaddPart()
Add message part
public
addPart(PartInterface $part) : Message
Parameters
- $part : PartInterface
Return values
MessageaddText()
Add text message part
public
addText(mixed $text) : Message
Parameters
- $text : mixed
Return values
MessageattachFile()
Attach file message part
public
attachFile(string $file[, string $encoding = AbstractPart::BASE64 ]) : Message
Parameters
- $file : string
- $encoding : string = AbstractPart::BASE64
Return values
MessageattachFileFromStream()
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
MessagedecodeText()
Decode text
public
static decodeText(string $text) : string
Parameters
- $text : string
Return values
stringgenerateBoundary()
Generate message MIME boundary
public
generateBoundary() : Message
Return values
MessagegenerateId()
Generate a new ID
public
generateId([string|null $domain = null ]) : string
Parameters
- $domain : string|null = null
Tags
Return values
stringgetBcc()
Get BCC
public
getBcc() : array<string|int, mixed>
Return values
array<string|int, mixed>getBody()
Get message body
public
getBody() : string|null
Return values
string|nullgetBoundary()
Get message MIME boundary
public
getBoundary() : string
Return values
stringgetCc()
Get CC
public
getCc() : array<string|int, mixed>
Return values
array<string|int, mixed>getCharSet()
Get message part character set
public
getCharSet() : string|null
Return values
string|nullgetContentType()
Get message part content type
public
getContentType() : string|null
Return values
string|nullgetFrom()
Get From
public
getFrom() : array<string|int, mixed>
Return values
array<string|int, mixed>getHeader()
Get message part header
public
getHeader(string $header) : string|null
Parameters
- $header : string
Return values
string|nullgetHeaderAsString()
Get header as string
public
getHeaderAsString(string $header) : string|null
Parameters
- $header : string
Return values
string|nullgetHeaders()
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
stringgetId()
Get the ID
public
getId() : string|null
Return values
string|nullgetIdHeader()
Get the ID
public
getIdHeader() : string|null
Return values
string|nullgetPart()
Get message part
public
getPart(int $i) : PartInterface|null
Parameters
- $i : int
Return values
PartInterface|nullgetParts()
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|null
Return values
string|nullgetTo()
Get To
public
getTo() : array<string|int, mixed>
Return values
array<string|int, mixed>hasAttachments()
Has attachments
public
hasAttachments() : bool
Return values
boolhasBcc()
Has BCC
public
hasBcc() : bool
Return values
boolhasCc()
Has CC
public
hasCc() : bool
Return values
boolhasFrom()
Has From
public
hasFrom() : bool
Return values
boolhasHeader()
Determine if message part has header
public
hasHeader(string $header) : bool
Parameters
- $header : string
Return values
boolhasReplyTo()
Has Reply-To
public
hasReplyTo() : bool
Return values
boolhasReturnPath()
Has Return-Path
public
hasReturnPath() : bool
Return values
boolhasSender()
Has Sender
public
hasSender() : bool
Return values
boolhasTo()
Has To
public
hasTo() : bool
Return values
boolload()
Load a message from a string source or file on disk
public
static load(string $message) : Message
Parameters
- $message : string
Tags
Return values
Messageparse()
Parse message from string
public
static parse(string $stream) : Message
Parameters
- $stream : string
Tags
Return values
MessageparseAddresses()
Parse addresses
public
parseAddresses(mixed $addresses[, bool $asArray = false ]) : string|array<string|int, mixed>
Parameters
- $addresses : mixed
- $asArray : bool = false
Return values
string|array<string|int, mixed>parseFromFile()
Parse message from file
public
static parseFromFile(string $file) : Message
Parameters
- $file : string
Tags
Return values
MessageparseNameAndEmail()
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
Messagerender()
Render message
public
render([array<string|int, mixed> $omitHeaders = [] ]) : string
Parameters
- $omitHeaders : array<string|int, mixed> = []
Return values
stringrenderAsLines()
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> = []
setBcc()
Set BCC
public
setBcc(mixed $bcc) : AbstractMessage
Parameters
- $bcc : mixed
Return values
AbstractMessagesetBody()
Set body
public
setBody(mixed $body) : Message
Parameters
- $body : mixed
Return values
MessagesetBoundary()
Set message MIME boundary
public
setBoundary(string $boundary) : Message
Parameters
- $boundary : string
Return values
MessagesetCc()
Set CC
public
setCc(mixed $cc) : AbstractMessage
Parameters
- $cc : mixed
Return values
AbstractMessagesetCharSet()
Set message part character set
public
setCharSet([string|null $charSet = null ]) : AbstractMessage
Parameters
- $charSet : string|null = null
Return values
AbstractMessagesetContentType()
Set message part content type
public
setContentType(string $contentType) : AbstractMessage
Parameters
- $contentType : string
Return values
AbstractMessagesetFrom()
Set From
public
setFrom(mixed $from) : AbstractMessage
Parameters
- $from : mixed
Return values
AbstractMessagesetId()
Set the ID
public
setId(string $id) : AbstractMessage
Parameters
- $id : string
Return values
AbstractMessagesetIdHeader()
Set the ID header name
public
setIdHeader(string $header) : AbstractMessage
Parameters
- $header : string
Return values
AbstractMessagesetReplyTo()
Set Reply-To
public
setReplyTo(mixed $replyTo) : AbstractMessage
Parameters
- $replyTo : mixed
Return values
AbstractMessagesetReturnPath()
Set Return-Path
public
setReturnPath(mixed $returnPath) : AbstractMessage
Parameters
- $returnPath : mixed
Return values
AbstractMessagesetSender()
Set Sender
public
setSender(mixed $sender) : AbstractMessage
Parameters
- $sender : mixed
Return values
AbstractMessagesetSubject()
Set Subject
public
setSubject(string $subject) : AbstractMessage
Parameters
- $subject : string
Return values
AbstractMessagesetTo()
Set To
public
setTo(mixed $to) : AbstractMessage
Parameters
- $to : mixed
Return values
AbstractMessagetoByteStream()
Write this entire entity to a buffer
public
toByteStream(BufferInterface $is[, array<string|int, mixed> $omitHeaders = [] ]) : void
Parameters
- $is : BufferInterface
- $omitHeaders : array<string|int, mixed> = []
getRandomId()
Returns a random ID
protected
getRandomId([string|null $idRight = null ]) : string
Parameters
- $idRight : string|null = null
Tags
Return values
stringvalidateContentType()
Validate content type based on message parts added to the message
protected
validateContentType() : void