class MailManager implements Factory mixin Mailer (View source)

Properties

protected Application $app

The application instance.

protected array $mailers

The array of resolved mailers.

protected array $customCreators

The registered custom driver creators.

Methods

void
__construct(Application $app)

Create a new Mail manager instance.

mailer(string|null $name = null)

Get a mailer instance by name.

driver(string|null $driver = null)

Get a mailer driver instance.

get(string $name)

Attempt to get the mailer from the local cache.

resolve(string $name)

Resolve the given mailer.

TransportInterface
createSymfonyTransport(array $config)

Create a new transport instance.

EsmtpTransport
createSmtpTransport(array $config)

Create an instance of the Symfony SMTP Transport driver.

EsmtpTransport
configureSmtpTransport(EsmtpTransport $transport, array $config)

Configure the additional SMTP driver options.

SendmailTransport
createSendmailTransport(array $config)

Create an instance of the Symfony Sendmail Transport driver.

createSesTransport(array $config)

Create an instance of the Symfony Amazon SES Transport driver.

createSesV2Transport(array $config)

Create an instance of the Symfony Amazon SES V2 Transport driver.

array
addSesCredentials(array $config)

Add the SES credentials to the configuration array.

ResendTransprot
createResendTransport(array $config)

Create an instance of the Resend Transport driver.

SendmailTransport
createMailTransport()

Create an instance of the Symfony Mail Transport driver.

TransportInterface
createMailgunTransport(array $config)

Create an instance of the Symfony Mailgun Transport driver.

PostmarkApiTransport
createPostmarkTransport(array $config)

Create an instance of the Symfony Postmark Transport driver.

FailoverTransport
createFailoverTransport(array $config)

Create an instance of the Symfony Failover Transport driver.

RoundRobinTransport
createRoundrobinTransport(array $config)

Create an instance of the Symfony Roundrobin Transport driver.

createLogTransport(array $config)

Create an instance of the Log Transport driver.

createArrayTransport()

Create an instance of the Array Transport Driver.

HttpClientInterface|null
getHttpClient(array $config)

Get a configured Symfony HTTP client instance.

void
setGlobalAddress(Mailer $mailer, array $config, string $type)

Set a global address on the mailer by type.

array
getConfig(string $name)

Get the mail connection configuration.

string
getDefaultDriver()

Get the default mail driver name.

void
setDefaultDriver(string $name)

Set the default mail driver name.

void
purge(string|null $name = null)

Disconnect the given mailer and remove from local cache.

$this
extend(string $driver, Closure $callback)

Register a custom transport creator Closure.

getApplication()

Get the application instance used by the manager.

$this
setApplication(Application $app)

Set the application instance used by the manager.

$this
forgetMailers()

Forget all of the resolved mailer instances.

mixed
__call(string $method, array $parameters)

Dynamically call the default driver instance.

Details

void __construct(Application $app)

Create a new Mail manager instance.

Parameters

Application $app

Return Value

void

Mailer mailer(string|null $name = null)

Get a mailer instance by name.

Parameters

string|null $name

Return Value

Mailer

Mailer driver(string|null $driver = null)

Get a mailer driver instance.

Parameters

string|null $driver

Return Value

Mailer

protected Mailer get(string $name)

Attempt to get the mailer from the local cache.

Parameters

string $name

Return Value

Mailer

protected Mailer resolve(string $name)

Resolve the given mailer.

Parameters

string $name

Return Value

Mailer

Exceptions

InvalidArgumentException

TransportInterface createSymfonyTransport(array $config)

Create a new transport instance.

Parameters

array $config

Return Value

TransportInterface

Exceptions

InvalidArgumentException

protected EsmtpTransport createSmtpTransport(array $config)

Create an instance of the Symfony SMTP Transport driver.

Parameters

array $config

Return Value

EsmtpTransport

protected EsmtpTransport configureSmtpTransport(EsmtpTransport $transport, array $config)

Configure the additional SMTP driver options.

Parameters

EsmtpTransport $transport
array $config

Return Value

EsmtpTransport

protected SendmailTransport createSendmailTransport(array $config)

Create an instance of the Symfony Sendmail Transport driver.

Parameters

array $config

Return Value

SendmailTransport

protected SesTransport createSesTransport(array $config)

Create an instance of the Symfony Amazon SES Transport driver.

Parameters

array $config

Return Value

SesTransport

protected SesV2Transport createSesV2Transport(array $config)

Create an instance of the Symfony Amazon SES V2 Transport driver.

Parameters

array $config

Return Value

SesV2Transport

protected array addSesCredentials(array $config)

Add the SES credentials to the configuration array.

Parameters

array $config

Return Value

array

protected ResendTransprot createResendTransport(array $config)

Create an instance of the Resend Transport driver.

Parameters

array $config

Return Value

ResendTransprot

protected SendmailTransport createMailTransport()

Create an instance of the Symfony Mail Transport driver.

Return Value

SendmailTransport

protected TransportInterface createMailgunTransport(array $config)

Create an instance of the Symfony Mailgun Transport driver.

Parameters

array $config

Return Value

TransportInterface

protected PostmarkApiTransport createPostmarkTransport(array $config)

Create an instance of the Symfony Postmark Transport driver.

Parameters

array $config

Return Value

PostmarkApiTransport

protected FailoverTransport createFailoverTransport(array $config)

Create an instance of the Symfony Failover Transport driver.

Parameters

array $config

Return Value

FailoverTransport

protected RoundRobinTransport createRoundrobinTransport(array $config)

Create an instance of the Symfony Roundrobin Transport driver.

Parameters

array $config

Return Value

RoundRobinTransport

protected LogTransport createLogTransport(array $config)

Create an instance of the Log Transport driver.

Parameters

array $config

Return Value

LogTransport

protected ArrayTransport createArrayTransport()

Create an instance of the Array Transport Driver.

Return Value

ArrayTransport

protected HttpClientInterface|null getHttpClient(array $config)

Get a configured Symfony HTTP client instance.

Parameters

array $config

Return Value

HttpClientInterface|null

protected void setGlobalAddress(Mailer $mailer, array $config, string $type)

Set a global address on the mailer by type.

Parameters

Mailer $mailer
array $config
string $type

Return Value

void

protected array getConfig(string $name)

Get the mail connection configuration.

Parameters

string $name

Return Value

array

string getDefaultDriver()

Get the default mail driver name.

Return Value

string

void setDefaultDriver(string $name)

Set the default mail driver name.

Parameters

string $name

Return Value

void

void purge(string|null $name = null)

Disconnect the given mailer and remove from local cache.

Parameters

string|null $name

Return Value

void

$this extend(string $driver, Closure $callback)

Register a custom transport creator Closure.

Parameters

string $driver
Closure $callback

Return Value

$this

Application getApplication()

Get the application instance used by the manager.

Return Value

Application

$this setApplication(Application $app)

Set the application instance used by the manager.

Parameters

Application $app

Return Value

$this

$this forgetMailers()

Forget all of the resolved mailer instances.

Return Value

$this

mixed __call(string $method, array $parameters)

Dynamically call the default driver instance.

Parameters

string $method
array $parameters

Return Value

mixed