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