class Envelope (View source)

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 meta data.

array $using

The message's Symfony Message customization callbacks.

Methods

$this|TWhenReturnType
when(TWhenParameter|TWhenParameter|null $value = null, callable|null $callback = null, callable|null $default = null)

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

$this|TUnlessReturnType
unless(TUnlessParameter|TUnlessParameter|null $value = null, callable|null $callback = null, callable|null $default = null)

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

void
__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 = [], Closure|array $using = [])

Create a new message envelope instance.

Address>
normalizeAddresses(Address|string> $addresses)

Normalize the given array of addresses.

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

Specify who the message will be "from".

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

Add a "to" recipient to the message envelope.

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

Add a "cc" recipient to the message envelope.

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

Add a "bcc" recipient to the message envelope.

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

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

$this
subject(string $subject)

Set the subject of the message.

$this
tags(array $tags)

Add "tags" to the message.

$this
tag(string $tag)

Add a "tag" to the message.

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

Add metadata to the message.

$this
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
hasRecipient(array $recipients, string $address, string|null $name = null)

Determine if the message has the given recipient.

bool
hasSubject(string $subject)

Determine if the message has the given subject.

bool
hasMetadata(string $key, string $value)

Determine if the message has the given metadata.

Details

$this|TWhenReturnType when(TWhenParameter|TWhenParameter|null $value = null, callable|null $callback = null, callable|null $default = null)

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

Parameters

TWhenParameter|TWhenParameter|null $value
callable|null $callback
callable|null $default

Return Value

$this|TWhenReturnType

$this|TUnlessReturnType unless(TUnlessParameter|TUnlessParameter|null $value = null, callable|null $callback = null, callable|null $default = null)

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

Parameters

TUnlessParameter|TUnlessParameter|null $value
callable|null $callback
callable|null $default

Return Value

$this|TUnlessReturnType

void __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 = [], Closure|array $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
Closure|array $using

Return Value

void

protected Address> normalizeAddresses(Address|string> $addresses)

Normalize the given array of addresses.

Parameters

Address|string> $addresses

Return Value

Address>

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

Specify who the message will be "from".

Parameters

Address|string $address
string|null $name

Return Value

$this

$this 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

$this

$this 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

$this

$this 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

$this

$this 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

$this

$this subject(string $subject)

Set the subject of the message.

Parameters

string $subject

Return Value

$this

$this tags(array $tags)

Add "tags" to the message.

Parameters

array $tags

Return Value

$this

$this tag(string $tag)

Add a "tag" to the message.

Parameters

string $tag

Return Value

$this

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

Add metadata to the message.

Parameters

string $key
string|int $value

Return Value

$this

$this using(Closure $callback)

Add a Symfony Message customization callback to the message.

Parameters

Closure $callback

Return Value

$this

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

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

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

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

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

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

bool hasSubject(string $subject)

Determine if the message has the given subject.

Parameters

string $subject

Return Value

bool

bool hasMetadata(string $key, string $value)

Determine if the message has the given metadata.

Parameters

string $key
string $value

Return Value

bool

Laravel Cloud is the best place to deploy Laravel, Nuxt, Express, Hono, Node.js, Bun, Go, Flask, Python, and more, with dedicated infrastructure available on AWS through Laravel Private Cloud.