MailManager
class MailManager implements Factory mixin Mailer
Traits
Constants
| protected TRANSPORT_PRESENTATION_KEYS |
Mailer-level keys that do not affect built-in transport construction. |
Properties
| protected Closure> | $releaseCallbacks | from HasPoolProxy | |
| protected Repository | $config | The config instance. |
|
| protected array | $mailers | The array of resolved mailers. |
|
| protected array | $customCreators | The registered custom driver creators. |
|
| protected array | $poolables | The array of drivers which will be wrapped as pool proxies. |
Methods
Create a pool proxy for an immutable definition.
Build a namespaced pool definition for a pooled resource.
Get the shared object-pool factory.
Get the release callback for a pooled driver.
Add a driver to the poolable-driver list.
Remove a driver from the poolable-driver list.
Create a new transport instance.
Create a pooled or direct transport for a mailer.
Resolve whether and how a mail transport should be pooled.
Create a transport from its fully resolved construction config.
Resolve the exact configuration consumed to construct a transport.
Resolve Mailgun's credential and HTTP-client construction config.
Resolve a composite transport's ordered child construction configs.
Extract HTTP-client options that affect transport construction.
Create an instance of the Symfony SMTP Transport driver.
Configure the additional SMTP driver options.
Create an instance of the Symfony Sendmail Transport driver.
Create an instance of the Symfony Amazon SES V2 Transport driver.
Add the SES credentials to the configuration array.
Create an instance of the Resend Transport driver.
Create an instance of the Cloudflare Transport driver.
Create an instance of the Symfony Mail Transport driver.
Create an instance of the Symfony Mailgun Transport driver.
Create an instance of the Symfony Postmark Transport driver.
Create an instance of the Symfony Failover Transport driver.
Create an instance of the Symfony Roundrobin Transport driver.
Create an instance of supplied class extending the Symfony Roundrobin Transport driver.
Create an instance of the Log Transport driver.
Create an instance of the Array Transport Driver.
Get a configured Symfony HTTP client instance.
Set a global address on the mailer by type.
Get the mail connection configuration.
Get the default mail driver name.
Set the default mail driver name.
Disconnect the given mailer and close its shared transport pool.
Get the application instance used by the manager.
Forget all of the resolved mailer instances.
Dynamically call the default driver instance.
Details
in
HasPoolProxy at line 24
protected mixed
createPoolProxy(string $driver, Closure $resolver, PoolDefinition $definition, string $proxyClass)
Create a pool proxy for an immutable definition.
in
HasPoolProxy at line 45
protected PoolDefinition
poolDefinition(string $resource, array $poolConfig, array $fingerprintSource)
Build a namespaced pool definition for a pooled resource.
at line 672
protected Factory
poolFactory()
Get the shared object-pool factory.
in
HasPoolProxy at line 71
HasPoolProxy
setReleaseCallback(string $driver, Closure $callback)
Set the release callback for a pooled driver.
Boot-only. The callback persists on the manager for the worker lifetime and is captured by every subsequently created proxy for the driver.
in
HasPoolProxy at line 81
Closure|null
getReleaseCallback(string $driver)
Get the release callback for a pooled driver.
in
HasPoolProxy at line 93
HasPoolProxy
addPoolable(string $driver)
Add a driver to the poolable-driver list.
Boot-only. The list persists on the manager for the worker lifetime and is consulted on subsequent driver creation. Per-request use races across coroutines and does not affect already-cached drivers.
in
HasPoolProxy at line 109
HasPoolProxy
removePoolable(string $driver)
Remove a driver from the poolable-driver list.
Boot-only. The list persists on the manager for the worker lifetime and is consulted on subsequent driver creation. Per-request use races across coroutines and does not affect already-cached drivers.
in
HasPoolProxy at line 126
array
getPoolables()
Get the poolable-driver list.
in
HasPoolProxy at line 138
HasPoolProxy
setPoolables(array $poolables)
Set the poolable-driver list.
Boot-only. The list persists on the manager for the worker lifetime and is consulted on subsequent driver creation. Per-request use races across coroutines and does not affect already-cached drivers.
at line 86
__construct(Container $app)
Create a new Mail manager instance.
at line 95
Mailer
mailer(UnitEnum|string|null $name = null)
Get a mailer instance by name.
at line 111
Mailer
driver(UnitEnum|string|null $driver = null)
Get a mailer driver instance.
at line 119
protected Mailer
get(string $name)
Attempt to get the mailer from the local cache.
at line 129
protected Mailer
resolve(string $name)
Resolve the given mailer.
at line 164
Mailer
build(array $config)
Build a new mailer instance.
at line 185
TransportInterface
createSymfonyTransport(array $config)
Create a new transport instance.
at line 197
protected TransportInterface
createMailerTransport(array $config, array $mailerStack = [], bool $poolByDefault = false)
Create a pooled or direct transport for a mailer.
at line 221
protected array|null
transportPoolConfig(string $transport, array $config, bool $poolByDefault)
Resolve whether and how a mail transport should be pooled.
at line 251
protected TransportInterface
createSymfonyTransportFromConstructionConfig(array $config)
Create a transport from its fully resolved construction config.
at line 270
protected array
transportConstructionConfig(array $config, array $mailerStack = [])
Resolve the exact configuration consumed to construct a transport.
at line 343
protected array
mailgunTransportConstructionConfig(array $config)
Resolve Mailgun's credential and HTTP-client construction config.
at line 365
protected array
compositeTransportConstructionConfig(string $transport, array $config, array $mailerStack)
Resolve a composite transport's ordered child construction configs.
at line 407
protected array
httpClientConstructionConfig(array $config)
Extract HTTP-client options that affect transport construction.
at line 415
protected EsmtpTransport
createSmtpTransport(array $config)
Create an instance of the Symfony SMTP Transport driver.
at line 441
protected EsmtpTransport
configureSmtpTransport(EsmtpTransport $transport, array $config)
Configure the additional SMTP driver options.
at line 461
protected SendmailTransport
createSendmailTransport(array $config)
Create an instance of the Symfony Sendmail Transport driver.
at line 469
protected SesV2Transport
createSesV2Transport(array $config)
Create an instance of the Symfony Amazon SES V2 Transport driver.
at line 482
protected array
addSesCredentials(array $config)
Add the SES credentials to the configuration array.
at line 498
protected ResendTransport
createResendTransport(array $config)
Create an instance of the Resend Transport driver.
at line 506
protected CloudflareTransport
createCloudflareTransport(array $config)
Create an instance of the Cloudflare Transport driver.
at line 518
protected SendmailTransport
createMailTransport()
Create an instance of the Symfony Mail Transport driver.
at line 526
protected TransportInterface
createMailgunTransport(array $config)
Create an instance of the Symfony Mailgun Transport driver.
at line 543
protected PostmarkApiTransport
createPostmarkTransport(array $config)
Create an instance of the Symfony Postmark Transport driver.
at line 564
protected FailoverTransport
createFailoverTransport(array $config)
Create an instance of the Symfony Failover Transport driver.
at line 572
protected RoundRobinTransport
createRoundrobinTransport(array $config)
Create an instance of the Symfony Roundrobin Transport driver.
at line 587
protected RoundRobinTransport
createRoundrobinTransportOfClass(array $config, string $class)
Create an instance of supplied class extending the Symfony Roundrobin Transport driver.
at line 601
protected LogTransport
createLogTransport(array $config)
Create an instance of the Log Transport driver.
at line 615
protected ArrayTransport
createArrayTransport()
Create an instance of the Array Transport Driver.
at line 625
protected HttpClientInterface|null
getHttpClient(array $config)
Get a configured Symfony HTTP client instance.
at line 644
protected void
setGlobalAddress(Mailer $mailer, array $config, string $type)
Set a global address on the mailer by type.
at line 656
protected array|null
getConfig(string $name)
Get the mail connection configuration.
at line 680
string
getDefaultDriver()
Get the default mail driver name.
at line 690
void
setDefaultDriver(UnitEnum|string $name)
Set the default mail driver name.
Boot-only. Mutates process-global config; per-request use races across coroutines.
at line 704
void
purge(UnitEnum|string|null $name = null)
Disconnect the given mailer and close its shared transport pool.
Boot or tests only, plus operational recovery of broken pooled resources. Other mailers sharing the pool transparently acquire a fresh pool on their next operation.
at line 756
MailManager
extend(string $driver, Closure $callback, bool $poolable = false)
Register a custom driver creator Closure.
Boot-only. The callback persists in the singleton's customCreators array (and the poolable list if $poolable is true) for the worker lifetime and applies to every subsequent transport resolution.
at line 770
Container
getApplication()
Get the application instance used by the manager.
at line 781
MailManager
setApplication(Container $app)
Set the application instance used by the manager.
Tests only. Swaps the singleton's container reference; per-request use races across coroutines and breaks every concurrent mail send.
at line 794
MailManager
forgetMailers()
Forget all of the resolved mailer instances.
Boot or tests only. This is cache-only: pooled transports remain shared resources until purged or reclaimed by their idle TTL.
at line 804
__call(string $method, array $parameters)
Dynamically call the default driver instance.