Skip to content

Commit

Permalink
name
Browse files Browse the repository at this point in the history
  • Loading branch information
gam6itko committed Jan 16, 2025
1 parent 3b926e3 commit 4b6543b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Traffic/Message/Smtp.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ private function parseContact(string $line): Contact
{
if (\preg_match('/^\s*(?<name>.*)\s*<(?<email>.*)>\s*$/', $line, $matches) === 1) {
return new Contact(
$matches['name'] ? \trim($matches['name'], ' "') : null,
$matches['name'] ? \trim(\trim($matches['name']), '"') : null,
$matches['email'] ? \trim($matches['email']) : null,
);
}
Expand Down
7 changes: 7 additions & 0 deletions tests/Unit/Traffic/Message/SmtpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ public static function dataTo(): iterable
new Smtp\Contact('Mary Smith: Personal Account', '[email protected]'),
],
];

yield [
['" Mary Smith: Personal Account " <[email protected]>'],
[
new Smtp\Contact(' Mary Smith: Personal Account ', '[email protected]'),
],
];
}

/**
Expand Down

0 comments on commit 4b6543b

Please sign in to comment.