class CloudflareTransport extends AbstractTransport (View source)

Properties

protected HttpClientInterface $client

The HTTP Client instance.

Methods

__construct(string $accountId, string $key, HttpClientInterface|null $client = null)

Create a new Cloudflare transport instance.

void
doSend(SentMessage $message)

{@inheritDoc}

array
getPayload(SentMessage $message)

Get the Cloudflare payload for the given message.

array
getRecipients(Email $email, Envelope $envelope)

Get the recipients without CC or BCC.

array
getCustomHeaders(Email $email)

Get the custom headers for the email, excluding the standard ones.

array
getAttachments(Email $email)

Get the attachments formatted for the Cloudflare API.

string|array
formatAddress(Address $address)

Get the address formatted for the Cloudflare API.

array
stringifyAddresses(array $addresses)

Get multiple addresses formatted as strings for the Cloudflare API.

string
__toString()

Get the string representation of the transport.

Details

__construct(string $accountId, string $key, HttpClientInterface|null $client = null)

Create a new Cloudflare transport instance.

Parameters

string $accountId
string $key
HttpClientInterface|null $client

protected void doSend(SentMessage $message)

{@inheritDoc}

Parameters

SentMessage $message

Return Value

void

Exceptions

TransportException

protected array getPayload(SentMessage $message)

Get the Cloudflare payload for the given message.

Parameters

SentMessage $message

Return Value

array

protected array getRecipients(Email $email, Envelope $envelope)

Get the recipients without CC or BCC.

Parameters

Email $email
Envelope $envelope

Return Value

array

protected array getCustomHeaders(Email $email)

Get the custom headers for the email, excluding the standard ones.

Parameters

Email $email

Return Value

array

protected array getAttachments(Email $email)

Get the attachments formatted for the Cloudflare API.

Parameters

Email $email

Return Value

array

protected string|array formatAddress(Address $address)

Get the address formatted for the Cloudflare API.

Parameters

Address $address

Return Value

string|array

protected array stringifyAddresses(array $addresses)

Get multiple addresses formatted as strings for the Cloudflare API.

Parameters

array $addresses

Return Value

array

string __toString()

Get the string representation of the transport.

Return Value

string

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.