Skip to content

Commit 4b6543b

Browse files
committed
name
1 parent 3b926e3 commit 4b6543b

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/Traffic/Message/Smtp.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ private function parseContact(string $line): Contact
191191
{
192192
if (\preg_match('/^\s*(?<name>.*)\s*<(?<email>.*)>\s*$/', $line, $matches) === 1) {
193193
return new Contact(
194-
$matches['name'] ? \trim($matches['name'], ' "') : null,
194+
$matches['name'] ? \trim(\trim($matches['name']), '"') : null,
195195
$matches['email'] ? \trim($matches['email']) : null,
196196
);
197197
}

tests/Unit/Traffic/Message/SmtpTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ public static function dataTo(): iterable
4343
new Smtp\Contact('Mary Smith: Personal Account', 'smith@home.example'),
4444
],
4545
];
46+
47+
yield [
48+
['" Mary Smith: Personal Account " <smith@home.example>'],
49+
[
50+
new Smtp\Contact(' Mary Smith: Personal Account ', 'smith@home.example'),
51+
],
52+
];
4653
}
4754

4855
/**

0 commit comments

Comments
 (0)