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.

Swift_Mailer
createSwiftMailer(array $config)

Create the SwiftMailer instance for the given configuration.

Swift_Transport
createTransport(array $config)

Create a new transport instance.

Swift_SmtpTransport
createSmtpTransport(array $config)

Create an instance of the SMTP Swift Transport driver.

Swift_SmtpTransport
configureSmtpTransport(Swift_SmtpTransport $transport, array $config)

Configure the additional SMTP driver options.

Swift_SendmailTransport
createSendmailTransport(array $config)

Create an instance of the Sendmail Swift Transport driver.

createSesTransport(array $config)

Create an instance of the Amazon SES Swift Transport driver.

array
addSesCredentials(array $config)

Add the SES credentials to the configuration array.

Swift_SendmailTransport
createMailTransport()

Create an instance of the Mail Swift Transport driver.

createMailgunTransport(array $config)

Create an instance of the Mailgun Swift Transport driver.

Swift_Transport
createPostmarkTransport(array $config)

Create an instance of the Postmark Swift Transport driver.

Swift_FailoverTransport
createFailoverTransport(array $config)

Create an instance of the Failover Swift Transport driver.

createLogTransport(array $config)

Create an instance of the Log Swift Transport driver.

createArrayTransport()

Create an instance of the Array Swift Transport Driver.

Client
guzzle(array $config)

Get a fresh Guzzle 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

protected Swift_Mailer createSwiftMailer(array $config)

Create the SwiftMailer instance for the given configuration.

Parameters

array $config

Return Value

Swift_Mailer

Swift_Transport createTransport(array $config)

Create a new transport instance.

Parameters

array $config

Return Value

Swift_Transport

Exceptions

InvalidArgumentException

protected Swift_SmtpTransport createSmtpTransport(array $config)

Create an instance of the SMTP Swift Transport driver.

Parameters

array $config

Return Value

Swift_SmtpTransport

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

Configure the additional SMTP driver options.

Parameters

Swift_SmtpTransport $transport
array $config

Return Value

Swift_SmtpTransport

protected Swift_SendmailTransport createSendmailTransport(array $config)

Create an instance of the Sendmail Swift Transport driver.

Parameters

array $config

Return Value

Swift_SendmailTransport

protected SesTransport createSesTransport(array $config)

Create an instance of the Amazon SES Swift Transport driver.

Parameters

array $config

Return Value

SesTransport

protected array addSesCredentials(array $config)

Add the SES credentials to the configuration array.

Parameters

array $config

Return Value

array

protected Swift_SendmailTransport createMailTransport()

Create an instance of the Mail Swift Transport driver.

Return Value

Swift_SendmailTransport

protected MailgunTransport createMailgunTransport(array $config)

Create an instance of the Mailgun Swift Transport driver.

Parameters

array $config

Return Value

MailgunTransport

protected Swift_Transport createPostmarkTransport(array $config)

Create an instance of the Postmark Swift Transport driver.

Parameters

array $config

Return Value

Swift_Transport

protected Swift_FailoverTransport createFailoverTransport(array $config)

Create an instance of the Failover Swift Transport driver.

Parameters

array $config

Return Value

Swift_FailoverTransport

protected LogTransport createLogTransport(array $config)

Create an instance of the Log Swift Transport driver.

Parameters

array $config

Return Value

LogTransport

protected ArrayTransport createArrayTransport()

Create an instance of the Array Swift Transport Driver.

Return Value

ArrayTransport

protected Client guzzle(array $config)

Get a fresh Guzzle HTTP client instance.

Parameters

array $config

Return Value

Client

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