Skip to content

Commit 3f357d2

Browse files
Merge branch '4.4' into 5.2
* 4.4: [ErrorHandler] fix handling buffered SilencedErrorContext [HttpClient] fix Psr18Client when allow_url_fopen=0 [DependencyInjection] Add support of PHP enumerations [Cache] handle prefixed redis connections when clearing pools [Cache] fix eventual consistency when using RedisTagAwareAdapter with a cluster [Validator][Translation] Add ExpressionLanguageSyntax en and fr [HttpKernel] [HttpCache] Keep s-maxage=0 from ESI sub-responses [Cache] Disable locking on Windows by default [DependencyInjection] Fix binding "iterable $foo" when using the PHP-DSL [Config] fix tracking default values that reference the parent class [DependencyInjection] fix accepted types on FactoryTrait::factory() [VarDumper] Fix tests for PHP 8.1 [Mailer] fix encoding of addresses using SmtpTransport [MonologBridge] Fix the server:log help --filter sample
2 parents 9b4d874 + ec33c78 commit 3f357d2

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

Tests/Transport/Smtp/SmtpTransportTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,25 @@ public function testSendInvalidMessage()
114114
$this->assertNotContains("\r\n.\r\n", $stream->getCommands());
115115
$this->assertTrue($stream->isClosed());
116116
}
117+
118+
public function testWriteEncodedRecipientAndSenderAddresses()
119+
{
120+
$stream = new DummyStream();
121+
122+
$transport = new SmtpTransport($stream);
123+
124+
$message = new Email();
125+
$message->from('sender@exämple.org');
126+
$message->addTo('recipient@exämple.org');
127+
$message->addTo('recipient2@example.org');
128+
$message->text('.');
129+
130+
$transport->send($message);
131+
132+
$this->assertContains("MAIL FROM:<sender@xn--exmple-cua.org>\r\n", $stream->getCommands());
133+
$this->assertContains("RCPT TO:<recipient@xn--exmple-cua.org>\r\n", $stream->getCommands());
134+
$this->assertContains("RCPT TO:<recipient2@example.org>\r\n", $stream->getCommands());
135+
}
117136
}
118137

119138
class DummyStream extends AbstractStream

Transport/Smtp/SmtpTransport.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,9 @@ protected function doSend(SentMessage $message): void
194194

195195
try {
196196
$envelope = $message->getEnvelope();
197-
$this->doMailFromCommand($envelope->getSender()->getAddress());
197+
$this->doMailFromCommand($envelope->getSender()->getEncodedAddress());
198198
foreach ($envelope->getRecipients() as $recipient) {
199-
$this->doRcptToCommand($recipient->getAddress());
199+
$this->doRcptToCommand($recipient->getEncodedAddress());
200200
}
201201

202202
$this->executeCommand("DATA\r\n", [354]);

0 commit comments

Comments
 (0)