createSmtpTransport example

$this->attachmentsBuilder,
            $this->filesystem,
            $this->documentRepository
        );
    }

    private function create(): TransportInterface
    {
        $emailAgent = $this->configService->getString('core.mailerSettings.emailAgent');

        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'),
            
Home | Imprint | This part of the site doesn't use cookies.