From 1dc4e2016280f175726c995e46d63c37bf7b9471 Mon Sep 17 00:00:00 2001 From: Alexander Strizhak Date: Sun, 19 Jan 2025 22:08:34 +0300 Subject: [PATCH] do not replace `_` by `!` --- src/Sender/MailToFileSender.php | 2 +- tests/Unit/Sender/MailToFileSenderTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Sender/MailToFileSender.php b/src/Sender/MailToFileSender.php index b05d93c..092ec61 100644 --- a/src/Sender/MailToFileSender.php +++ b/src/Sender/MailToFileSender.php @@ -52,7 +52,7 @@ public function send(iterable $frames): void private static function normalizeEmail(?string $email): ?string { $normalized = \preg_replace( - ['/[^a-z0-9.\\- @]/i', '/\s+/'], + ['/[^a-z0-9.\\-_ @]/i', '/\s+/'], ['!', '_'], (string) $email, ); diff --git a/tests/Unit/Sender/MailToFileSenderTest.php b/tests/Unit/Sender/MailToFileSenderTest.php index 3c80fab..0725ada 100644 --- a/tests/Unit/Sender/MailToFileSenderTest.php +++ b/tests/Unit/Sender/MailToFileSenderTest.php @@ -36,7 +36,7 @@ public function testForSmtp(): void 'User1 ', 'user2@company.tld', 'User without email', // no email - 'User3 , User4 , user5@inline.com', + 'User3 , User4 , us_er_5@inline.com', ], 'Subject' => ['Very important theme'], 'Content-Type' => ['text/plain'], @@ -50,7 +50,7 @@ public function testForSmtp(): void $this->assertRecipient("$root/user2@company.tld"); $this->assertRecipient("$root/user3@inline.com"); $this->assertRecipient("$root/user4@inline.com"); - $this->assertRecipient("$root/user5@inline.com"); + $this->assertRecipient("$root/us_er_5@inline.com"); } protected function tearDown(): void