InfobipSmtpTransport example

public static function createProvider(): iterable
    {
        $logger = new NullLogger();

        yield [
            new Dsn('infobip+api', 'example.com', self::PASSWORD),
            (new InfobipApiTransport(self::PASSWORD, new MockHttpClient(), null, $logger))->setHost('example.com'),
        ];

        yield [
            new Dsn('infobip', 'default', self::PASSWORD),
            new InfobipSmtpTransport(self::PASSWORD, null, $logger),
        ];

        yield [
            new Dsn('infobip+smtp', 'default', self::PASSWORD),
            new InfobipSmtpTransport(self::PASSWORD, null, $logger),
        ];

        yield [
            new Dsn('infobip+smtps', 'default', self::PASSWORD),
            new InfobipSmtpTransport(self::PASSWORD, null, $logger),
        ];
    }
$host = $dsn->getHost();
            if ('default' === $host) {
                throw new IncompleteDsnException('Infobip mailer for API DSN must contain a host.');
            }

            return (new InfobipApiTransport($apiKey$this->client, $this->dispatcher, $this->logger))
                ->setHost($host)
            ;
        }

        if (\in_array($schema['infobip+smtp', 'infobip+smtps', 'infobip'], true)) {
            return new InfobipSmtpTransport($apiKey$this->dispatcher, $this->logger);
        }

        throw new UnsupportedSchemeException($dsn, 'infobip', $this->getSupportedSchemes());
    }

    protected function getSupportedSchemes(): array
    {
        return ['infobip', 'infobip+api', 'infobip+smtp', 'infobip+smtps'];
    }
}
Home | Imprint | This part of the site doesn't use cookies.