[Mailer] fix encoding of addresses using SmtpTransport
This commit is contained in:
parent
dd2e6059b5
commit
608a3e596a
@ -114,6 +114,25 @@ class SmtpTransportTest extends TestCase
|
|||||||
$this->assertNotContains("\r\n.\r\n", $stream->getCommands());
|
$this->assertNotContains("\r\n.\r\n", $stream->getCommands());
|
||||||
$this->assertTrue($stream->isClosed());
|
$this->assertTrue($stream->isClosed());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testWriteEncodedRecipientAndSenderAddresses()
|
||||||
|
{
|
||||||
|
$stream = new DummyStream();
|
||||||
|
|
||||||
|
$transport = new SmtpTransport($stream);
|
||||||
|
|
||||||
|
$message = new Email();
|
||||||
|
$message->from('sender@exämple.org');
|
||||||
|
$message->addTo('recipient@exämple.org');
|
||||||
|
$message->addTo('recipient2@example.org');
|
||||||
|
$message->text('.');
|
||||||
|
|
||||||
|
$transport->send($message);
|
||||||
|
|
||||||
|
$this->assertContains("MAIL FROM:<sender@xn--exmple-cua.org>\r\n", $stream->getCommands());
|
||||||
|
$this->assertContains("RCPT TO:<recipient@xn--exmple-cua.org>\r\n", $stream->getCommands());
|
||||||
|
$this->assertContains("RCPT TO:<recipient2@example.org>\r\n", $stream->getCommands());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class DummyStream extends AbstractStream
|
class DummyStream extends AbstractStream
|
||||||
|
@ -194,9 +194,9 @@ class SmtpTransport extends AbstractTransport
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$envelope = $message->getEnvelope();
|
$envelope = $message->getEnvelope();
|
||||||
$this->doMailFromCommand($envelope->getSender()->getAddress());
|
$this->doMailFromCommand($envelope->getSender()->getEncodedAddress());
|
||||||
foreach ($envelope->getRecipients() as $recipient) {
|
foreach ($envelope->getRecipients() as $recipient) {
|
||||||
$this->doRcptToCommand($recipient->getAddress());
|
$this->doRcptToCommand($recipient->getEncodedAddress());
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->executeCommand("DATA\r\n", [354]);
|
$this->executeCommand("DATA\r\n", [354]);
|
||||||
|
Reference in New Issue
Block a user