class TransportServiceFactory
The default mailer transport service factory.
Hierarchy
- class \Drupal\Core\Mailer\TransportServiceFactory implements \Drupal\Core\Mailer\TransportServiceFactoryInterface uses \Drupal\Core\Mailer\TransportServiceFactoryTrait
Expanded class hierarchy of TransportServiceFactory
1 file declares its use of TransportServiceFactory
- TransportTest.php in core/
modules/ mailer/ tests/ src/ Kernel/ TransportTest.php
File
-
core/
lib/ Drupal/ Core/ Mailer/ TransportServiceFactory.php, line 15
Namespace
Drupal\Core\MailerView source
class TransportServiceFactory implements TransportServiceFactoryInterface {
use TransportServiceFactoryTrait;
/**
* Constructs a new transport service factory.
*
* @param Iterable<TransportFactoryInterface> $factories
* A list of transport factories.
* @param \Drupal\Core\Config\ConfigFactoryInterface $configFactory
* The config factory service.
*/
public function __construct(#[AutowireIterator(tag: 'mailer.transport_factory')] iterable $factories, protected ConfigFactoryInterface $configFactory) {
$this->factories = $factories;
}
/**
* {@inheritdoc}
*/
public function createTransport() : TransportInterface {
$dsn = $this->configFactory
->get('system.mail')
->get('mailer_dsn');
$dsnObject = new Dsn(...$dsn);
return $this->fromDsnObject($dsnObject);
}
}
Members
| Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
|---|---|---|---|---|
| TransportServiceFactory::createTransport | public | function | Overrides TransportServiceFactoryInterface::createTransport | |
| TransportServiceFactory::__construct | public | function | Constructs a new transport service factory. | |
| TransportServiceFactoryTrait::$factories | protected | property | A list of transport factories. | |
| TransportServiceFactoryTrait::fromDsnObject | protected | function | Constructs a transport instance given a DSN object. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.