Skip to content

Commit

Permalink
fix(MailToFileSender): allow _ in email names (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
gam6itko authored Jan 19, 2025
1 parent ae1f691 commit 4e207ba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Sender/MailToFileSender.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Sender/MailToFileSenderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function testForSmtp(): void
'User1 <[email protected]>',
'[email protected]',
'User without email', // no email
'User3 <[email protected]>, User4 <[email protected]>, user5@inline.com',
'User3 <[email protected]>, User4 <[email protected]>, us_er_5@inline.com',
],
'Subject' => ['Very important theme'],
'Content-Type' => ['text/plain'],
Expand All @@ -50,7 +50,7 @@ public function testForSmtp(): void
$this->assertRecipient("$root/[email protected]");
$this->assertRecipient("$root/[email protected]");
$this->assertRecipient("$root/[email protected]");
$this->assertRecipient("$root/user5@inline.com");
$this->assertRecipient("$root/us_er_5@inline.com");
}

protected function tearDown(): void
Expand Down

0 comments on commit 4e207ba

Please sign in to comment.