class Envelope

Traits

Properties

Address|string|null $from

The address sending the message.

array $to

The recipients of the message.

array $cc

The recipients receiving a copy of the message.

array $bcc

The recipients receiving a blind copy of the message.

array $replyTo

The recipients that should be replied to.

string|null $subject

The subject of the message.

array $tags

The message's tags.

array $metadata

The message's metadata.

array $using

The message's Symfony Message customization callbacks.

Methods

mixed
when(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) truthy.

mixed
unless(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) falsy.

__construct(Address|string|null $from = null, Address|string> $to = [], Address|string> $cc = [], Address|string> $bcc = [], Address|string> $replyTo = [], string|null $subject = null, array $tags = [], array $metadata = [], array|Closure $using = [])

Create a new message envelope instance.

array
normalizeAddresses(array $addresses)

Normalize the given array of addresses.

from(Address|string $address, string|null $name = null)

Specify who the message will be "from".

to(Address|array|string $address, string|null $name = null)

Add a "to" recipient to the message envelope.

cc(Address|array|string $address, string|null $name = null)

Add a "cc" recipient to the message envelope.

bcc(Address|array|string $address, string|null $name = null)

Add a "bcc" recipient to the message envelope.

replyTo(Address|array|string $address, string|null $name = null)

Add a "reply to" recipient to the message envelope.

subject(string $subject)

Set the subject of the message.

tags(array $tags)

Add "tags" to the message.

tag(string $tag)

Add a "tag" to the message.

metadata(string $key, int|string $value)

Add metadata to the message.

using(Closure $callback)

Add a Symfony Message customization callback to the message.

bool
isFrom(string $address, string|null $name = null)

Determine if the message is from the given address.

bool
hasTo(string $address, string|null $name = null)

Determine if the message has the given address as a recipient.

bool
hasCc(string $address, string|null $name = null)

Determine if the message has the given address as a "cc" recipient.

bool
hasBcc(string $address, string|null $name = null)

Determine if the message has the given address as a "bcc" recipient.

bool
hasReplyTo(string $address, string|null $name = null)

Determine if the message has the given address as a "reply to" recipient.

bool
hasSubject(string $subject)

Determine if the message has the given subject.

bool
hasMetadata(string $key, int|string $value)

Determine if the message has the given metadata.

bool
hasRecipient(array $recipients, string $address, string|null $name = null)

Determine if the message has the given recipient.

Details

in Conditionable at line 23
mixed when(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) truthy.

Parameters

mixed $value
callable|null $callback
callable|null $default

Return Value

mixed

in Conditionable at line 56
mixed unless(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) falsy.

Parameters

mixed $value
callable|null $callback
callable|null $default

Return Value

mixed

at line 71
__construct(Address|string|null $from = null, Address|string> $to = [], Address|string> $cc = [], Address|string> $bcc = [], Address|string> $replyTo = [], string|null $subject = null, array $tags = [], array $metadata = [], array|Closure $using = [])

Create a new message envelope instance.

Parameters

Address|string|null $from
Address|string> $to
Address|string> $cc
Address|string> $bcc
Address|string> $replyTo
string|null $subject
array $tags
array $metadata
array|Closure $using

at line 90
protected array normalizeAddresses(array $addresses)

Normalize the given array of addresses.

Parameters

array $addresses

Return Value

array

at line 100
Envelope from(Address|string $address, string|null $name = null)

Specify who the message will be "from".

Parameters

Address|string $address
string|null $name

Return Value

Envelope

at line 110
Envelope to(Address|array|string $address, string|null $name = null)

Add a "to" recipient to the message envelope.

Parameters

Address|array|string $address
string|null $name

Return Value

Envelope

at line 122
Envelope cc(Address|array|string $address, string|null $name = null)

Add a "cc" recipient to the message envelope.

Parameters

Address|array|string $address
string|null $name

Return Value

Envelope

at line 134
Envelope bcc(Address|array|string $address, string|null $name = null)

Add a "bcc" recipient to the message envelope.

Parameters

Address|array|string $address
string|null $name

Return Value

Envelope

at line 146
Envelope replyTo(Address|array|string $address, string|null $name = null)

Add a "reply to" recipient to the message envelope.

Parameters

Address|array|string $address
string|null $name

Return Value

Envelope

at line 158
Envelope subject(string $subject)

Set the subject of the message.

Parameters

string $subject

Return Value

Envelope

at line 168
Envelope tags(array $tags)

Add "tags" to the message.

Parameters

array $tags

Return Value

Envelope

at line 178
Envelope tag(string $tag)

Add a "tag" to the message.

Parameters

string $tag

Return Value

Envelope

at line 188
Envelope metadata(string $key, int|string $value)

Add metadata to the message.

Parameters

string $key
int|string $value

Return Value

Envelope

at line 198
Envelope using(Closure $callback)

Add a Symfony Message customization callback to the message.

Parameters

Closure $callback

Return Value

Envelope

at line 208
bool isFrom(string $address, string|null $name = null)

Determine if the message is from the given address.

Parameters

string $address
string|null $name

Return Value

bool

at line 221
bool hasTo(string $address, string|null $name = null)

Determine if the message has the given address as a recipient.

Parameters

string $address
string|null $name

Return Value

bool

at line 229
bool hasCc(string $address, string|null $name = null)

Determine if the message has the given address as a "cc" recipient.

Parameters

string $address
string|null $name

Return Value

bool

at line 237
bool hasBcc(string $address, string|null $name = null)

Determine if the message has the given address as a "bcc" recipient.

Parameters

string $address
string|null $name

Return Value

bool

at line 245
bool hasReplyTo(string $address, string|null $name = null)

Determine if the message has the given address as a "reply to" recipient.

Parameters

string $address
string|null $name

Return Value

bool

at line 253
bool hasSubject(string $subject)

Determine if the message has the given subject.

Parameters

string $subject

Return Value

bool

at line 261
bool hasMetadata(string $key, int|string $value)

Determine if the message has the given metadata.

Parameters

string $key
int|string $value

Return Value

bool

at line 269
protected bool hasRecipient(array $recipients, string $address, string|null $name = null)

Determine if the message has the given recipient.

Parameters

array $recipients
string $address
string|null $name

Return Value

bool