Skip to content

Commit d71df74

Browse files
change to add tests for bug #23 on github in RFC2184
1 parent fd00a3e commit d71df74

3 files changed

Lines changed: 217 additions & 0 deletions

File tree

‎Class Library/ActiveUp.Net.Tests/ActiveUp.Net.Tests.csproj‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@
119119
<None Include="resource\content-transfer-encode-8bit-charset-utf8-new-lined.eml">
120120
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
121121
</None>
122+
<None Include="resource\email_with_attach_rfc2184.eml">
123+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
124+
</None>
122125
<None Include="resource\html_multipart_email_with_more_than_one_subpart.eml">
123126
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
124127
</None>

‎Class Library/ActiveUp.Net.Tests/Common/ParserTests.cs‎

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,5 +289,61 @@ public void MustParseEmlFromIphone()
289289
Assert.AreEqual(htmlMessageExpected, resultHtml);
290290
}
291291

292+
[Test(Description = "From GitHub Issue 23.")]
293+
public void MustParseRussianEmlWithRFC2184()
294+
{
295+
var message = Parser.ParseMessageFromFile(_baseDir + "\\resource\\email_with_attach_rfc2184.eml");
296+
Assert.AreEqual("b475ae12b1e08b0ce84702ff5a52b89b@autodepo.ru", message.MessageId);
297+
Assert.AreEqual("Прайс", message.Subject);
298+
Assert.IsFalse(string.IsNullOrWhiteSpace(message.BodyText.Text));
299+
var textMessageExpected = @"
300+
301+
--
302+
303+
С УВАЖЕНИЕМ, СЕРГЕЙ ПИЛИЦКИЙ
304+
305+
СПЕЦИАЛИСТ ОТДЕЛА ИНТЕРНЕТ-ПРОДАЖ
306+
307+
ООО ""АвтоДепо""
308+
г. Москва, Востряковский проезд, владение 10, корп.1 (МКАД 31км)
309+
Тел.: (495) 374-91-88
310+
РњРѕР±.: +7 985 613-6988
311+
Skype: retail.msc.ad
312+
www.autodepo.ru [1]
313+
314+
315+
316+
Links:
317+
------
318+
[1] http://autodepo.ru/
319+
";
320+
var resultText = message.BodyText.Text;
321+
Assert.AreEqual(textMessageExpected, resultText);
322+
Assert.IsFalse(string.IsNullOrWhiteSpace(message.BodyHtml.Text));
323+
var htmlMessageExpected = @"<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN""><html>
324+
<head>
325+
<meta http-equiv=""Content-Type"" content=""text/html; charset=utf-8""></head>
326+
<body style=""font-family: Verdana,Geneva,sans-serif"">
327+
<p>&nbsp;</p>
328+
<p>&nbsp;</p>
329+
<div>-- <br>
330+
<pre>&nbsp;</pre>
331+
<table class="" cke_show_border"" cellspacing=""10"">
332+
<tbody>
333+
<tr>
334+
<td valign=""top"">
335+
<div><img style=""border-radius: 45px; width: 90px; height: 90px;"" src=""http://autodepo.ru/dna/images/useravatar/thumbs/5edef865738da8299112d9732bb935d2.jpg"" alt=""""></div>
336+
</td>
337+
<td><strong>С уважением, Сергей Пилицкий </strong><br><br><strong>Специалист отдела интернет-продаж</strong><br><br>ООО &quot;АвтоДепо&quot;<br>г. Москва, Востряковский проезд, владение 10, корп.1 (МКАД 31км)<br>Тел.: (495) 374-91-88<br>Моб.: &#43;7 985 613-6988<br>Skype: retail.msc.ad<br><a href=""http://autodepo.ru/"">www.autodepo.ru</a></td>
338+
</tr>
339+
</tbody>
340+
</table>
341+
</div>
342+
</body></html>
343+
";
344+
var resultHtml = message.BodyHtml.Text;
345+
Assert.AreEqual(htmlMessageExpected, resultHtml);
346+
Assert.AreEqual("%D0%9F%D1%80%D0%B0%D0%B9%D1%81-%D0%BB%D0%B8%D1%81%D1%82%20%D0%90%D0%B2%D1%82%D0%BE%D0%B4%D0%B5%D0%BF%D0%BE%20%D0%9C%D0%A1%D0%9A%2005_04_17.xls", message.Attachments[0].Filename);
347+
}
292348
}
293349
}
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
Received: from ORIGIN.universum.ru (192.168.203.252) by POSTMAN.universum.ru
2+
(192.168.203.251) with Microsoft SMTP Server (TLS) id 15.0.516.32 via Mailbox
3+
Transport; Wed, 5 Apr 2017 08:30:44 +0300
4+
Received: from ORIGIN.universum.ru (192.168.203.252) by origin.universum.ru
5+
(192.168.203.252) with Microsoft SMTP Server (TLS) id 15.0.516.32; Wed, 5 Apr
6+
2017 08:30:07 +0300
7+
Received: from autostels.ru (192.168.200.99) by ORIGIN.universum.ru
8+
(192.168.203.252) with Microsoft SMTP Server (TLS) id 15.0.516.32 via
9+
Frontend Transport; Wed, 5 Apr 2017 08:30:07 +0300
10+
X-Spam-Status: No, hits=0.0 required=9.5 tests=TOTAL_SCORE: 0.000
11+
X-Spam-Level:
12+
Received: from localhost ([127.0.0.1]) by autostels.ru for
13+
stock_auto@autostels.ru; Wed, 5 Apr 2017 08:30:07 +0300
14+
Resent-From: <auto_stoc@autostels.ru>
15+
Resent-To: <stock_auto@autostels.ru>
16+
Resent-Date: Wed, 5 Apr 2017 08:30:07 +0300
17+
X-Loop: <auto_stoc@autostels.ru>
18+
Received: from localhost ([127.0.0.1]) by autostels.ru (using TLSv1/SSLv3 with
19+
cipher AES128-SHA (128 bits)) for auto_stoc@autostels.ru; Wed, 5 Apr 2017
20+
08:30:05 +0300
21+
X-CrossPremisesHeadersFilteredBySendConnector: origin.universum.ru
22+
Received: from ORIGIN.universum.ru (192.168.203.252) by origin.universum.ru
23+
(192.168.203.252) with Microsoft SMTP Server (TLS) id 15.0.516.32; Wed, 5 Apr
24+
2017 08:30:04 +0300
25+
Received: from autostels.ru (192.168.200.99) by ORIGIN.universum.ru
26+
(192.168.203.252) with Microsoft SMTP Server (TLS) id 15.0.516.32 via
27+
Frontend Transport; Wed, 5 Apr 2017 08:30:04 +0300
28+
X-Spam-Status: No, hits=0.0 required=9.5 tests=TOTAL_SCORE: 0.000
29+
X-Spam-Level:
30+
Received: from www.autodepo.ru ([91.218.230.226]) by autostels.ru (using
31+
TLSv1/SSLv3 with cipher AES128-SHA (128 bits)) for auto_stoc@autostels.ru;
32+
Wed, 5 Apr 2017 08:29:58 +0300
33+
Received: from localhost.localdomain ([127.0.0.1]:46496 helo=autodepo.ru) by
34+
www.autodepo.ru with esmtp (Exim 4.80) (envelope-from
35+
<retail.msc@autodepo.ru>) id 1cvdVq-0006zf-VW for auto_stoc@autostels.ru;
36+
Wed, 05 Apr 2017 08:29:47 +0300
37+
Content-Type: multipart/mixed; boundary="=_61169006f2dde02e6fedd43fb1fd17d5"
38+
Date: Wed, 5 Apr 2017 15:29:46 +1000
39+
From: =?UTF-8?Q?=D0=9F=D0=B8=D0=BB=D0=B8=D1=86=D0=BA=D0=B8=D0=B9_=D0=A1?=
40+
=?UTF-8?Q?=D0=B5=D1=80=D0=B3=D0=B5=D0=B9?= <retail.msc@autodepo.ru>
41+
To: <auto_stoc@autostels.ru>
42+
Subject: =?koi8-r?B?8NLBytM=?=
43+
Organization: =?UTF-8?Q?=D0=9E=D0=9E=D0=9E_=22=D0=90=D0=B2=D1=82=D0=BE?=
44+
=?UTF-8?Q?=D0=94=D0=B5=D0=BF=D0=BE=22?=
45+
Message-ID: <b475ae12b1e08b0ce84702ff5a52b89b@autodepo.ru>
46+
X-Sender: retail.msc@autodepo.ru
47+
User-Agent: Roundcube Webmail/0.9.4
48+
Return-Path: retail.msc@autodepo.ru
49+
X-OrganizationHeadersPreserved: origin.universum.ru
50+
X-MS-Exchange-Organization-Network-Message-Id: 700f3f3f-feb3-4d29-656c-08d47be4d278
51+
X-MS-Exchange-Organization-AVStamp-Enterprise: 1.0
52+
X-MS-Exchange-Organization-AuthSource: origin.universum.ru
53+
X-MS-Exchange-Organization-AuthAs: Anonymous
54+
MIME-Version: 1.0
55+
56+
--=_61169006f2dde02e6fedd43fb1fd17d5
57+
Content-Type: multipart/alternative;
58+
boundary="=_399962d54987547573734fd0690f2624"
59+
60+
--=_399962d54987547573734fd0690f2624
61+
Content-Transfer-Encoding: 8bit
62+
Content-Type: text/plain; charset="UTF-8"
63+
64+
65+
66+
--
67+
68+
С УВАЖЕНИЕМ, СЕРГЕЙ ПИЛИЦКИЙ
69+
70+
СПЕЦИАЛИСТ ОТДЕЛА ИНТЕРНЕТ-ПРОДАЖ
71+
72+
ООО "АвтоДепо"
73+
г. Москва, Востряковский проезд, владение 10, корп.1 (МКАД 31км)
74+
Тел.: (495) 374-91-88
75+
РњРѕР±.: +7 985 613-6988
76+
Skype: retail.msc.ad
77+
www.autodepo.ru [1]
78+
79+
80+
81+
Links:
82+
------
83+
[1] http://autodepo.ru/
84+
85+
--=_399962d54987547573734fd0690f2624
86+
Content-Transfer-Encoding: quoted-printable
87+
Content-Type: text/html; charset="UTF-8"
88+
89+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"><html>
90+
<head>
91+
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dutf-8"></=
92+
head>
93+
<body style=3D"font-family: Verdana,Geneva,sans-serif">
94+
<p>&nbsp;</p>
95+
<p>&nbsp;</p>
96+
<div>-- <br>
97+
<pre>&nbsp;</pre>
98+
<table class=3D" cke_show_border" cellspacing=3D"10">
99+
<tbody>
100+
<tr>
101+
<td valign=3D"top">
102+
<div><img style=3D"border-radius: 45px; width: 90px; height: 90px;" src=3D"=
103+
http://autodepo.ru/dna/images/useravatar/thumbs/5edef865738da8299112d9732bb=
104+
935d2.jpg" alt=3D""></div>
105+
</td>
106+
<td><strong>=D0=A1 =D1=83=D0=B2=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8=D0=B5=D0=BC, =
107+
=D0=A1=D0=B5=D1=80=D0=B3=D0=B5=D0=B9 =D0=9F=D0=B8=D0=BB=D0=B8=D1=86=D0=BA=
108+
=D0=B8=D0=B9 </strong><br><br><strong>=D0=A1=D0=BF=D0=B5=D1=86=D0=B8=D0=B0=
109+
=D0=BB=D0=B8=D1=81=D1=82 =D0=BE=D1=82=D0=B4=D0=B5=D0=BB=D0=B0 =D0=B8=D0=BD=
110+
=D1=82=D0=B5=D1=80=D0=BD=D0=B5=D1=82-=D0=BF=D1=80=D0=BE=D0=B4=D0=B0=D0=B6</=
111+
strong><br><br>=D0=9E=D0=9E=D0=9E &quot;=D0=90=D0=B2=D1=82=D0=BE=D0=94=D0=
112+
=B5=D0=BF=D0=BE&quot;<br>=D0=B3. =D0=9C=D0=BE=D1=81=D0=BA=D0=B2=D0=B0, =D0=
113+
=92=D0=BE=D1=81=D1=82=D1=80=D1=8F=D0=BA=D0=BE=D0=B2=D1=81=D0=BA=D0=B8=D0=B9=
114+
=D0=BF=D1=80=D0=BE=D0=B5=D0=B7=D0=B4, =D0=B2=D0=BB=D0=B0=D0=B4=D0=B5=D0=BD=
115+
=D0=B8=D0=B5 10, =D0=BA=D0=BE=D1=80=D0=BF.1 (=D0=9C=D0=9A=D0=90=D0=94 31=D0=
116+
=BA=D0=BC)<br>=D0=A2=D0=B5=D0=BB.: (495) 374-91-88<br>=D0=9C=D0=BE=D0=B1.: =
117+
&#43;7 985 613-6988<br>Skype: retail.msc.ad<br><a href=3D"http://autodepo.r=
118+
u/">www.autodepo.ru</a></td>
119+
</tr>
120+
</tbody>
121+
</table>
122+
</div>
123+
</body></html>
124+
125+
--=_399962d54987547573734fd0690f2624--
126+
127+
--=_61169006f2dde02e6fedd43fb1fd17d5
128+
Content-Transfer-Encoding: base64
129+
Content-Type: application/vnd.ms-excel;
130+
name*0*="UTF-8''%D0%9F%D1%80%D0%B0%D0%B9%D1%81-%D0%BB%D0%B8%D1%81%D1%82%20";
131+
name*1*="%D0%90%D0%B2%D1%82%D0%BE%D0%B4%D0%B5%D0%BF%D0%BE%20%D0%9C%D0%A1";
132+
name*2*="%D0%9A%2005_04_17.xls"
133+
Content-Disposition: attachment;
134+
filename*0*="UTF-8''%D0%9F%D1%80%D0%B0%D0%B9%D1%81-%D0%BB%D0%B8%D1%81%D1";
135+
filename*1*="%82%20%D0%90%D0%B2%D1%82%D0%BE%D0%B4%D0%B5%D0%BF%D0%BE%20%D0";
136+
filename*2*="%9C%D0%A1%D0%9A%2005_04_17.xls"; size=648704
137+
138+
0M8R4KGxGuEAAAAAAAAAAAAAAAAAAAAAPgADAP7/CQAGAAAAAAAAAAAAAAAKAAAAAgAAAAAAAAAA
139+
EAAA/v///wAAAAD+////AAAAAAMAAAAEAAAABQAAAAYAAAAHAAAACAAAAAkAAAAKAAAACwAAAAwA
140+
AAD/////////////////////////////////////////////////////////////////////////
141+
////////////////////////////////////////////////////////////////////////////
142+
////////////////////////////////////////////////////////////////////////////
143+
////////////////////////////////////////////////////////////////////////////
144+
////////////////////////////////////////////////////////////////////////////
145+
////////////////////////////////////////////////////////////////////////////
146+
///////////////////////////////////////////////////////////////////////////9
147+
/////v//////////////////////////////////////////////////////////////////////
148+
////////////////////////////////////////////////////////////////////////////
149+
////////////////////////////////////////////////////////////////////////////
150+
////////////////////////////////////////////////////////////////////////////
151+
////////////////////////////////////////////////////////////////////////////
152+
////////////////////////////////////////////////////////////////////////////
153+
////////////////////////////////////////////////////////////////////////////
154+
////////////////////////////////////////////////////////////////////////////
155+
/////////////////////////////////////////////////////////////////////////1IA
156+
=
157+
158+
--=_61169006f2dde02e6fedd43fb1fd17d5--

0 commit comments

Comments
 (0)