File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff 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
119138class DummyStream extends AbstractStream
Original file line number Diff line number Diff 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 ]);
You can’t perform that action at this time.
0 commit comments