class Message extends MimePart

Mail provides functionality to compose and send both text and MIME-compliant multipart email messages.

Constants

HIGH

Priority

NORMAL

Priority

LOW

Priority

Properties

static array $defaultHeaders
string $subject
string $htmlBody

Methods

__construct()

No description

setFrom($email, $name = null)

Sets the sender of the message.

array
getFrom()

Returns the sender of the message.

addReplyTo($email, $name = null)

Adds the reply-to address.

setSubject($subject)

Sets the subject of the message.

string|null
getSubject()

Returns the subject of the message.

addTo($email, $name = null)

Adds email recipient.

addCc($email, $name = null)

Adds carbon copy email recipient.

addBcc($email, $name = null)

Adds blind carbon copy email recipient.

setReturnPath($email)

Sets the Return-Path header of the message.

string
getReturnPath()

Returns the Return-Path header.

setPriority($priority)

Sets email priority.

int
getPriority()

Returns email priority.

setHtmlBody($html, $basePath = null)

Sets HTML body.

string
getHtmlBody()

Gets HTML body.

addEmbeddedFile($file, $content = null, $contentType = null)

Adds embedded file.

addInlinePart(MimePart $part)

Adds inlined Mime Part.

addAttachment($file, $content = null, $contentType = null)

Adds attachment.

getAttachments()

Gets all email attachments.

string
generateMessage()

Returns encoded message.

build()

Builds email. Does not modify itself, but returns a new object.

string
buildText($html)

Builds text content.

Details

at line 43
__construct()

No description

at line 58
Message setFrom($email, $name = null)

Sets the sender of the message.

Parameters

$email
$name

Return Value

Message

at line 69
array getFrom()

Returns the sender of the message.

Return Value

array

at line 81
Message addReplyTo($email, $name = null)

Adds the reply-to address.

Parameters

$email
$name

Return Value

Message

at line 93
Message setSubject($subject)

Sets the subject of the message.

Parameters

$subject

Return Value

Message

at line 104
string|null getSubject()

Returns the subject of the message.

Return Value

string|null

at line 116
Message addTo($email, $name = null)

Adds email recipient.

Parameters

$email
$name

Return Value

Message

at line 129
Message addCc($email, $name = null)

Adds carbon copy email recipient.

Parameters

$email
$name

Return Value

Message

at line 142
Message addBcc($email, $name = null)

Adds blind carbon copy email recipient.

Parameters

$email
$name

Return Value

Message

at line 170
Message setReturnPath($email)

Sets the Return-Path header of the message.

Parameters

$email

Return Value

Message

at line 181
string getReturnPath()

Returns the Return-Path header.

Return Value

string

at line 192
Message setPriority($priority)

Sets email priority.

Parameters

$priority

Return Value

Message

at line 203
int getPriority()

Returns email priority.

Return Value

int

at line 215
Message setHtmlBody($html, $basePath = null)

Sets HTML body.

Parameters

$html
$basePath

Return Value

Message

at line 265
string getHtmlBody()

Gets HTML body.

Return Value

string

at line 278
MimePart addEmbeddedFile($file, $content = null, $contentType = null)

Adds embedded file.

Parameters

$file
$content
$contentType

Return Value

MimePart

at line 290
Message addInlinePart(MimePart $part)

Adds inlined Mime Part.

Parameters

MimePart $part

Return Value

Message

at line 304
MimePart addAttachment($file, $content = null, $contentType = null)

Adds attachment.

Parameters

$file
$content
$contentType

Return Value

MimePart

at line 314
MimePart[] getAttachments()

Gets all email attachments.

Return Value

MimePart[]

at line 363
string generateMessage()

Returns encoded message.

Return Value

string

at line 373
protected Message build()

Builds email. Does not modify itself, but returns a new object.

Return Value

Message

at line 422
protected string buildText($html)

Builds text content.

Parameters

$html

Return Value

string