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

deprecated HIGH

deprecated NORMAL

deprecated LOW

Properties

static $defaultHeaders

Methods

__construct()

No description

setFrom(string $email, string|null $name = null)

Sets the sender of the message. Email or format "John Doe" doe@example.com

array|null
getFrom()

Returns the sender of the message.

addReplyTo(string $email, string|null $name = null)

Adds the reply-to address. Email or format "John Doe" doe@example.com

setSubject(string $subject)

Sets the subject of the message.

string|null
getSubject()

Returns the subject of the message.

addTo(string $email, string|null $name = null)

Adds email recipient. Email or format "John Doe" doe@example.com

addCc(string $email, string|null $name = null)

Adds carbon copy email recipient. Email or format "John Doe" doe@example.com

addBcc(string $email, string|null $name = null)

Adds blind carbon copy email recipient. Email or format "John Doe" doe@example.com

setReturnPath(string $email)

Sets the Return-Path header of the message.

string|null
getReturnPath()

Returns the Return-Path header.

setPriority(int $priority)

Sets email priority.

int|null
getPriority()

Returns email priority.

setHtmlBody(string $html, string|null $basePath = null)

Sets HTML body.

string
getHtmlBody()

Gets HTML body.

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

Adds embedded file.

addInlinePart(MimePart $part)

Adds inlined Mime Part.

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

Adds attachment.

array
getAttachments()

Gets all email attachments.

string
generateMessage()

Returns encoded message.

build()

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

string
buildText(string $html)

Builds text content.

Details

at line 49
__construct()

No description

at line 62
Message setFrom(string $email, string|null $name = null)

Sets the sender of the message. Email or format "John Doe" doe@example.com

Parameters

string $email
string|null $name

Return Value

Message

at line 72
array|null getFrom()

Returns the sender of the message.

Return Value

array|null

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

Adds the reply-to address. Email or format "John Doe" doe@example.com

Parameters

string $email
string|null $name

Return Value

Message

at line 91
Message setSubject(string $subject)

Sets the subject of the message.

Parameters

string $subject

Return Value

Message

at line 101
string|null getSubject()

Returns the subject of the message.

Return Value

string|null

at line 110
Message addTo(string $email, string|null $name = null)

Adds email recipient. Email or format "John Doe" doe@example.com

Parameters

string $email
string|null $name

Return Value

Message

at line 120
Message addCc(string $email, string|null $name = null)

Adds carbon copy email recipient. Email or format "John Doe" doe@example.com

Parameters

string $email
string|null $name

Return Value

Message

at line 130
Message addBcc(string $email, string|null $name = null)

Adds blind carbon copy email recipient. Email or format "John Doe" doe@example.com

Parameters

string $email
string|null $name

Return Value

Message

at line 158
Message setReturnPath(string $email)

Sets the Return-Path header of the message.

Parameters

string $email

Return Value

Message

at line 168
string|null getReturnPath()

Returns the Return-Path header.

Return Value

string|null

at line 177
Message setPriority(int $priority)

Sets email priority.

Parameters

int $priority

Return Value

Message

at line 187
int|null getPriority()

Returns email priority.

Return Value

int|null

at line 197
Message setHtmlBody(string $html, string|null $basePath = null)

Sets HTML body.

Parameters

string $html
string|null $basePath

Return Value

Message

at line 247
string getHtmlBody()

Gets HTML body.

Return Value

string

at line 256
MimePart addEmbeddedFile(string $file, string|null $content = null, string|null $contentType = null)

Adds embedded file.

Parameters

string $file
string|null $content
string|null $contentType

Return Value

MimePart

at line 266
Message addInlinePart(MimePart $part)

Adds inlined Mime Part.

Parameters

MimePart $part

Return Value

Message

at line 276
MimePart addAttachment(string $file, string|null $content = null, string|null $contentType = null)

Adds attachment.

Parameters

string $file
string|null $content
string|null $contentType

Return Value

MimePart

at line 286
array getAttachments()

Gets all email attachments.

Return Value

array

at line 332
string generateMessage()

Returns encoded message.

Return Value

string

at line 341
Message build()

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

Return Value

Message

at line 389
protected string buildText(string $html)

Builds text content.

Parameters

string $html

Return Value

string