CramMd5Authenticator example

// S: 250 2.0.0 Resetting             ],
            $stream->getCommands()
        );
    }

    public function testConstructorWithRedefinedAuthenticators()
    {
        $stream = new DummyStream();
        $transport = new EsmtpTransport(
            stream: $stream,
            authenticators: [new CramMd5Authenticator()new LoginAuthenticator()]
        );
        $transport->setUsername('testuser');
        $transport->setPassword('p4ssw0rd');

        $message = new Email();
        $message->from('sender@example.org');
        $message->addTo('recipient@example.org');
        $message->text('.');

        try {
            $transport->send($message);
            
private string $password = '';
    private array $capabilities;

    public function __construct(string $host = 'localhost', int $port = 0, bool $tls = null, EventDispatcherInterface $dispatcher = null, LoggerInterface $logger = null, AbstractStream $stream = null, array $authenticators = null)
    {
        parent::__construct($stream$dispatcher$logger);

        if (null === $authenticators) {
            // fallback to default authenticators             // order is important here (roughly most secure and popular first)             $authenticators = [
                new Auth\CramMd5Authenticator(),
                new Auth\LoginAuthenticator(),
                new Auth\PlainAuthenticator(),
                new Auth\XOAuth2Authenticator(),
            ];
        }
        $this->setAuthenticators($authenticators);

        /** @var SocketStream $stream */
        $stream = $this->getStream();

        if (null === $tls) {
            
Home | Imprint | This part of the site doesn't use cookies.