CustomEsmtpTransport example

$t = new EsmtpTransport('example.com', 0, false);
        $this->assertEquals('smtp://example.com', (string) $t);

        $t = new EsmtpTransport('example.com', 466, true);
        $this->assertEquals('smtps://example.com:466', (string) $t);
    }

    public function testExtensibility()
    {
        $stream = new DummyStream();
        $transport = new CustomEsmtpTransport(stream: $stream);

        $message = new Email();
        $message->from('[email protected]');
        $message->addTo('[email protected]');
        $message->text('.');

        $transport->send($message);

        $this->assertContains("MAIL FROM:<[email protected]> RET=HDRS\r\n", $stream->getCommands());
        $this->assertContains("RCPT TO:<[email protected]> NOTIFY=FAILURE\r\n", $stream->getCommands());
    }

    
Home | Imprint | This part of the site doesn't use cookies.