return match ($emailAgent) { 'smtp' =>
$this->
createSmtpTransport($this->configService
),
'local' =>
new SendmailTransport($this->
getSendMailCommandLineArgument($this->configService
)),
default =>
throw new \
RuntimeException(sprintf('Invalid mail agent given "%s"',
$emailAgent)),
};
} private function createSmtpTransport(SystemConfigService
$configService): TransportInterface
{ $dsn =
new Dsn( $this->
getEncryption($configService) === 'ssl' ? 'smtps' : 'smtp',
$configService->
getString('core.mailerSettings.host'
),
$configService->
getString('core.mailerSettings.username'
),
$configService->
getString('core.mailerSettings.password'
),
$configService->
getInt('core.mailerSettings.port'
),
$this->
getEncryption($configService) !== null ?
[] :
['verify_peer' => 0
] );
return $this->envBasedTransport->
fromDsnObject($dsn);
} private function getEncryption(SystemConfigService
$configService): ?string
{