Skip to content

Commit 7de6f94

Browse files
committed
add test for AddressList parsing with semicolon in name
1 parent 59561e5 commit 7de6f94

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

tests/Mail/LoadEmailTest.php

+12
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,16 @@ public function testLoadOddMboxHeader(): void
5959
$mail = MailMessage::createFromString($raw);
6060
$this->assertTrue($mail->getHeaders()->has('X-Broken-Header-Mbox'));
6161
}
62+
63+
/**
64+
* From: "Famous bearings |;" <[email protected]>
65+
*/
66+
public function testLoadInvalidName(): void
67+
{
68+
$raw = $this->readDataFile('110616.txt');
69+
$mail = MailMessage::createFromString($raw);
70+
$headers = $mail->getHeaders();
71+
$this->assertEquals('"Famous bearings |;" <[email protected]>', $headers->get('From')->getFieldValue());
72+
$this->assertEquals('Famous bearings | <[email protected]>', $headers->get('Reply-To')->getFieldValue());
73+
}
6274
}

tests/data/110616.txt

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
Return-Path: <[email protected]>
2+
Delivered-To: [email protected]
3+
Received: from win2003 ([127.0.0.1]) by localhost via TCP with ESMTPA;
4+
Tue, 02 Jul 2019 03:31:13 +0800
5+
MIME-Version: 1.0
6+
From: "Famous bearings |;" <[email protected]>
7+
8+
Date: 2 Jul 2019 03:31:13 +0800
9+
Subject: =?utf-8?B?cyBiZWFyaW5ncyAgICBFbmI=?=
10+
Content-Type: multipart/alternative;
11+
boundary=--boundary_118276_94ad25ae-43fa-4eb6-968c-fc87bcdcbd75
12+
Message-Id: <[email protected]>
13+
Reply-To: "Famous bearings |" <[email protected]>
14+
15+
16+
17+
18+
----boundary_118276_94ad25ae-43fa-4eb6-968c-fc87bcdcbd75
19+
Content-Type: text/plain; charset=utf-8
20+
Content-Transfer-Encoding: base64
21+
22+
UmljayBhbmQgbW9ydHkgcnVsZXMK
23+
24+
----boundary_118276_94ad25ae-43fa-4eb6-968c-fc87bcdcbd75
25+
Content-Type: text/html; charset=utf-8
26+
Content-Transfer-Encoding: base64
27+
28+
UmljayBhbmQgbW9ydHkgcnVsZXMK
29+
30+
----boundary_118276_94ad25ae-43fa-4eb6-968c-fc87bcdcbd75--
31+
32+

0 commit comments

Comments
 (0)