1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
|
/*
* Copyright (c) 2005-2006 NFG Net Facilities Group BV support@nfg.nl
*
* licence: GPLv2
* see COPYING for details.
*
*/
#include "dbmail.h"
#define THIS_MODULE "check"
char *configFile = "/etc/dbmail/dbmail-test.conf";
/* simple testmessages. */
char *simple = "From nobody Wed Sep 14 16:47:48 2005\n"
"X-Foo: bar\n"
"Message-Id: <1199706209l.3020l.0l@(none)>\n"
"Subject: dbmail test message\n"
"\n"
"\n"
" this is a test message\n"
"\n";
char *simple_with_from = "From nobody@pacific.net.sg Tue Dec 04 19:52:17 2007\n"
"X-Envelope-From: <nobody@pacific.net.sg>\n"
"Received: from [127.0.0.1] (port=49353 helo=test11)\n"
" by centos.nowhere.com with smtp (Exim 4.63)\n"
" (envelope-from <nobody@pacific.net.sg>)\n"
" id 1IzWJv-0000Ep-5f\n"
" for wallace@nowhere.com; Tue, 04 Dec 2007 19:52:17 +0800\n"
"From: \"Wallace\" <nobody@pacific.net.sg>\n"
"To: wallace <wallace@nowhere.com>\n"
"Subject: Test 11\n"
"Message-Id: <E1IzWJv-0000Ep-5f@centos.nowhere.com>\n"
"Date: Tue, 04 Dec 2007 19:52:16 +0800\n"
"\n"
"\n"
"This line works, however,\n"
"From what I know, this line gets truncated\n"
"This line gets truncated\n"
"This other line get truncated too\n";
char *rfc822 = "From nobody Wed Sep 14 16:47:48 2005\n"
"Content-Type: text/plain; charset=\"us-ascii\"\n"
"MIME-Version: 1.0\n"
"Content-Transfer-Encoding: 7bit\n"
"Message-Id: <1199706209l.3020l.1l@(none)>\n"
"To: testuser@foo.org\n"
"From: somewher@foo.org\n"
"Subject: dbmail test message\n"
"\n"
"\n"
" this is a test message\n"
"\n";
char * utf7_header = "From: \"Some Body\" <s.body@freeler.nl>\n"
"Subject: simple subject\n"
"To: =?iso-8859-1?Q?::_=5B_Arrty_=5D_::_=5B_Roy_=28L=29_St=E8phanie_=5D?= <over.there@hotmail.com>\n"
"Date: Thu, 11 Oct 2007 19:00:37 +0200\n"
"MIME-Version: 1.0\n"
"\n"
" test message\n"
"\n";
char *multipart_message = "From: \"Brother from another planet\" <vol@inter7.com>\n"
"To: \"Brother from another planet\" <vol@inter7.com>\n"
"Reply-to: \"Brother from another planet\" <vol@inter7.com>\n"
"Cc: \"Brother from another planet\" <vol@inter7.com>,\n"
" \"SpongeBob O'Brien\" <nobody@test123.com>\n"
"Subject: multipart/mixed\n"
"References: <5.1.0.14.0.20020926105718.01c0a568@mail>\n"
" <5.1.0.14.0.20020926105718.01c0a568@mail>\n"
"Date: Wed, 11 May 2005 13:20:08 -0700\n"
"Received: at mx.inter7.com from localhost\n"
"Received: at localhost from localhost\n"
"Received: at localhost from localhost\n"
"Message-Id: <1199706209l.3020l.2l@(none)>\n"
"MIME-Version: 1.0\n"
"Content-type: multipart/mixed; boundary=boundary\n"
"X-Dbmail-ID: 12345\n"
"\n"
"MIME multipart messages specify that there are multiple\n"
"messages of possibly different types included in the\n"
"message. All peices will be availble by the user-agent\n"
"if possible.\n"
"\n"
"The header 'Content-disposition: inline' states that\n"
"if possible, the user-agent should display the contents\n"
"of the attachment as part of the email, rather than as\n"
"a file, or message attachment.\n"
"\n"
"(This message will not be seen by the user)\n"
"\n"
"--boundary\n"
"Content-type: text/html\n"
"Content-disposition: inline\n"
"\n"
"Test message one\n"
"--boundary\n"
"Content-type: text/plain; charset=us-ascii; name=testfile\n"
"Content-transfer-encoding: base64\n"
"\n"
"IyEvYmluL2Jhc2gNCg0KY2xlYXINCmVjaG8gIi4tLS0tLS0tLS0tLS0tLS0t\n"
"LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS4i\n"
"DQplY2hvICJ8IE1hcmNoZXcuSHlwZXJyZWFsIHByZXNlbnRzOiB2aXhpZSBj\n"
"cm9udGFiIGV4cGxvaXQgIzcyODM3MSB8Ig0KZWNobyAifD09PT09PT09PT09\n"
"PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09\n"
"PT09fCINCmVjaG8gInwgU2ViYXN0aWFuIEtyYWhtZXIgPGtyYWhtZXJAc2Vj\n"
"dXJpdHkuaXM+ICAgICAgICAgICAgICAgICAgIHwiDQplY2hvICJ8IE1pY2hh\n"
"--boundary--\n";
char *multipart_message2 = "From return@trafficmagnet.com Mon Aug 5 19:26:52 2002\n"
"Received: with ECARTIS (v1.0.0; list dovecot); Mon, 05 Aug 2002 19:26:52 +0300 (EEST)\n"
"Return-Path: <return@trafficmagnet.com>\n"
"Delivered-To: dovecot@procontrol.fi\n"
"Received: from ns5.trafficmagnet.net (unknown [211.157.101.52])\n"
" by danu.procontrol.fi (Postfix) with ESMTP id 48C2C23831\n"
" for <dovecot@procontrol.fi>; Mon, 5 Aug 2002 19:26:51 +0300 (EEST)\n"
"Received: from 181-Dispatcher ([211.101.236.181])\n"
" by ns5.trafficmagnet.net (8.11.6/8.11.6) with SMTP id g765MXt31378\n"
" for <dovecot@procontrol.fi>; Tue, 6 Aug 2002 00:22:34 -0500\n"
"Message-Id: <200208060522.g765MXt31378@ns5.trafficmagnet.net>\n"
"From: Sarah Williams <return@trafficmagnet.com>\n"
"To: \"dovecot@procontrol.fi\" <dovecot@procontrol.fi>\n"
"Subject: [dovecot] DOVECOT.PROCONTROL.FI\n"
"Date: Tue, 6 Aug 2002 0:29:18 +0800\n"
"X-Mailer: CSMTPConnection v2.17\n"
"MIME-Version: 1.0\n"
"Content-Type: multipart/related; boundary=\"956bff02-8aec-485e-a58c-40fda617ecbe\"\n"
"Content-Transfer-Encoding: quoted-printable\n"
"Reply-To: Sarah Williams <Sarah_williams@trafficmagnet.com>\n"
"X-archive-position: 4\n"
"X-ecartis-version: Ecartis v1.0.0\n"
"Sender: dovecot-bounce@procontrol.fi\n"
"Errors-to: dovecot-bounce@procontrol.fi\n"
"X-original-sender: return@trafficmagnet.com\n"
"Precedence: bulk\n"
"X-list: dovecot\n"
"X-UID: 4 \n"
"Status: O\n"
"Content-Length: 2421\n\n"
"This is a MIME message\n"
"--956bff02-8aec-485e-a58c-40fda617ecbe\n"
"Content-Type: text/html; charset=iso-8859-1\n"
"Content-Transfer-Encoding: quoted-printable\n"
"\n"
"<HTML>\n"
"<HEAD>\n"
"<!-- Ap --> \n"
"<TITLE></TITLE>\n"
"<STYLE TYPE=3D\"text/css\">\n"
"<!--\n"
"TD { font-family: verdana, arial, helvetica; font-size: 11px; color: #000000 =\n"
"}\n"
"-->\n"
"</STYLE>\n"
"</HEAD>\n"
"<BODY BGCOLOR=3D\"#FFFFFF\">\n"
"<TABLE WIDTH=3D\"600\" BORDER=3D\"0\" CELLSPACING=3D\"0\" CELLPADDING=3D\"0\">\n"
"<TR>\n"
" <TD>Hi<BR>\n"
" <BR>\n"
" I visited <A HREF=3D=\n"
"\"http://www.trafficmagnet.com/signup/index.html\">DOVECOT.PROCONTROL.FI</A>, =\n"
"and \n"
" noticed that you're not listed on some search engines! I think we can offer =\n"
"\n"
" you a service which can help you increase traffic and the number of visitors =\n"
"\n"
" to your website.<BR>\n"
" <BR>\n"
" I would like to introduce you to <A HREF=3D=\n"
"\"http://www.trafficmagnet.com/signup/index.html\">TrafficMagnet.com</A>. We =\n"
"offer a unique technology \n"
" that will submit your website to over 300,000 search engines and directories =\n"
"\n"
" every month.<BR>\n"
" <BR> \n"
" <TABLE WIDTH=3D\"398\" BORDER=3D\"0\" CELLSPACING=3D\"0\" CELLPADDING=3D\"0\" =\n"
"ALIGN=3D\"center\">\n"
" <TR>\n"
" <TD><A HREF=3D\"http://www.trafficmagnet.com/signup/index.html\"><IMG SRC=3D=\n"
"\"http://www.trafficmagnet.com/img/img_tm.gif\" WIDTH=3D\"137\" HEIGHT=3D\"136\" =\n"
"BORDER=3D\"0\"></A> </TD>\n"
" <TD><A HREF=3D\"http://www.trafficmagnet.com/signup/index.html\"><IMG SRC=3D=\n"
"\"http://image10.trafficmagnet.net/imagenew/SMART173/002/337/aso.jpg\" WIDTH=3D=\n"
"\"197\" HEIGHT=3D\"141\" BORDER=3D\"1\"></A></TD>\n"
" <TD VALIGN=3D\"bottom\"><A HREF=3D=\n"
"\"http://www.trafficmagnet.com/signup/index.html\"><IMG SRC=3D=\n"
"\"http://www.trafficmagnet.com/img/img_signup.gif\" WIDTH=3D\"62\" HEIGHT=3D\"136\" =\n"
"BORDER=3D\"0\"></A></TD>\n"
" </TR>\n"
" </TABLE>\n"
" <BR>\n"
" You'll be surprised by the low cost, and by how effective this website =\n"
"promotion \n"
" method can be. <BR>\n"
" <BR>\n"
" To find out more about TrafficMagnet and the cost for submitting your =\n"
"website \n"
" to over 300,000 search engines and directories, visit <A HREF=3D=\n"
"\"http://www.trafficmagnet.com/signup/index.html\">www.TrafficMagnet.com</A>. \n"
" <BR>\n"
" <BR>\n"
" I would love to hear from you. <BR>\n"
" <BR><BR>\n"
" Best Regards,<BR><BR>\n"
" Sarah Williams <BR>\n"
" Sales and Marketing <BR>\n"
" E-mail: sarah_williams@trafficmagnet.com <BR>\n"
" <A HREF=3D=\n"
"\"http://www.trafficmagnet.com/signup/index.html\">http://www.TrafficMagnet.com=\n"
"</A> \n"
" </TD>\n"
"</TR>\n"
"</TABLE>\n"
"</BODY>\n"
"</HTML>\n"
"--956bff02-8aec-485e-a58c-40fda617ecbe--\n"
"\n";
//
char *multipart_alternative = "From paul@nfg.nl Tue Oct 11 13:06:24 2005\n"
"Message-ID: <43E5FE98.4030609@nfg.nl>\n"
"Date: Sun, 05 Feb 2006 14:33:12 +0100\n"
"From: Paul J Stevens <paul@nfg.nl>\n"
"Organization: NFG Net Facilities Group BV\n"
"User-Agent: Debian Thunderbird 1.0.2 (X11/20051002)\n"
"X-Accept-Language: en-us, en\n"
"To: paul@nfg.nl\n"
"Subject: test\n"
"Message-Id: <1199706209l.3020l.3l@(none)>\n"
"X-Enigmail-Version: 0.91.0.0\n"
"X-DBMail-PhysMessage-ID: 841010\n"
"MIME-Version: 1.0\n"
"Content-Type: multipart/mixed; boundary=------------050000030206040804030909\n"
"\n"
"This is a multi-part message in MIME format.\n"
"--------------050000030206040804030909\n"
"Content-Type: multipart/alternative; boundary=\"------------040302030903000400040101\"\n"
"\n"
"\n"
"--------------040302030903000400040101\n"
"Content-Type: text/plain; charset=ISO-8859-1\n"
"Content-Transfer-Encoding: 7bit\n"
"\n"
"\n"
"test\n"
"\n"
"-- \n"
"________________________________________________________________\n"
"Paul Stevens mailto:paul@nfg.nl\n"
"NET FACILITIES GROUP PGP: finger paul@nfg.nl\n"
"The Netherlands________________________________http://www.nfg.nl\n"
"\n"
"\n"
"--------------040302030903000400040101\n"
"Content-Type: text/html; charset=ISO-8859-1\n"
"Content-Transfer-Encoding: 7bit\n"
"\n"
"<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n"
"<html>\n"
"<head>\n"
"<meta content=\"text/html;charset=ISO-8859-1\" http-equiv=\"Content-Type\">\n"
"<title></title>\n"
"</head>\n"
"<body bgcolor=\"#ffffff\" text=\"#000000\">\n"
"<h1>test</h1>\n"
"<pre class=\"moz-signature\" cols=\"72\">-- \n"
"________________________________________________________________\n"
"Paul Stevens <a class=\"moz-txt-link-freetext\" href=\"mailto:paul@nfg.nl\">mailto:paul@nfg.nl</a>\n"
"NET FACILITIES GROUP PGP: finger <a class=\"moz-txt-link-abbreviated\" href=\"mailto:paul@nfg.nl\">paul@nfg.nl</a>\n"
"The Netherlands________________________________<a class=\"moz-txt-link-freetext\" href=\"http://www.nfg.nl\">http://www.nfg.nl</a>\n"
"</pre>\n"
"</body>\n"
"</html>\n"
"\n"
"--------------040302030903000400040101--\n"
"\n"
"--------------050000030206040804030909\n"
"Content-Type: image/jpeg; name=\"jesse_2.jpg\"\n"
"Content-Transfer-Encoding: base64\n"
"Content-Disposition: inline; filename=\"jesse_2.jpg\"\n"
"\n"
"/9j/4AAQSkZJRgABAQEASABIAAD/4RirRXhpZgAASUkqAAgAAAAJAA8BAgAGAAAAegAAABAB\n"
"AgAWAAAAgAAAABIBAwABAAAABgAAABoBBQABAAAAlgAAABsBBQABAAAAngAAACgBAwABAAAA\n"
"4SSSAjbtIaCVfBmeySSaBgF/QFxTe0wJwuA1XS6lm9zCPS6TTckkozVoEzHvqhq6WySQ6mYI\n"
"7LF3kd0klwPUfuX7HS032seT7fokkkufZpP/2Q==\n"
"--------------050000030206040804030909--\n";
//
char *outlook_multipart = "From aprilbabies-bounces@lists.nfg.nl Fri Nov 25 22: 34:35 2005\n"
"From: \"Foo Bar\" <foobar@foo.bar>\n"
"To: \"My List...\" <mylist@foo.bar>\n"
"Subject: RE: [MyList] blah\n"
"Date: Fri, 25 Nov 2005 22:34:16 +0100\n"
"Message-ID: <IFEIKJKAMPLPGJIEIMEECEIFEDAA.ka@sus.se>\n"
"MIME-Version: 1.0\n"
"Content-Type: multipart/mixed;\n"
" boundary=\"===============0825346837==\"\n"
"\n"
"--===============0825346837==\n"
"Content-Type: text/plain;\n"
" charset=\"Windows-1252\"\n"
"Content-Transfer-Encoding: 7bit\n"
"\n"
"test\n"
"\n"
"\n"
"--===============0825346837==\n"
"Content-Type: text/plain; charset=\"iso-8859-1\"\n"
"MIME-Version: 1.0\n"
"Content-Transfer-Encoding: quoted-printable\n"
"Content-Disposition: inline\n"
"\n"
"my sig.\n"
"--===============0825346837==--\n"
"\n";
/* raw_lmtp_data is equal to multipart_message, except for the line-endings
* and the termination dot.
*/
char *raw_lmtp_data = "From: \"Brother from another planet\" <vol@inter7.com>\r\n"
"To: \"Brother from another planet\" <vol@inter7.com>\r\n"
"Subject: multipart/mixed\r\n"
"Reply-to: \"Brother from another planet\" <vol@inter7.com>\r\n"
"Cc: \"Brother from another planet\" <vol@inter7.com>,\r\n"
" \"SpongeBob O'Brien\" <nobody@test123.com>\r\n"
"Date: Wed, 11 May 2005 13:20:08 -0700\n"
"Received: at mx.inter7.com from localhost\r\n"
"Received: at localhost from localhost\r\n"
"Message-Id: <1199706209l.3020l.4l@(none)>\r\n"
"MIME-Version: 1.0\r\n"
"Content-type: multipart/mixed; boundary=\"boundary\"\r\n"
"X-Dbmail-ID: 12345\r\n"
"\r\n"
"MIME multipart messages specify that there are multiple\r\n"
"messages of possibly different types included in the\r\n"
"message. All peices will be availble by the user-agent\r\n"
"if possible.\r\n"
"\r\n"
"The header 'Content-disposition: inline' states that\r\n"
"if possible, the user-agent should display the contents\r\n"
"of the attachment as part of the email, rather than as\r\n"
"a file, or message attachment.\r\n"
"\r\n"
"(This message will not be seen by the user)\r\n"
"\r\n"
"--boundary\r\n"
"Content-type: text/html\r\n"
"Content-disposition: inline\r\n"
"\r\n"
"Test message one\r\n"
"--boundary\r\n"
"Content-type: text/plain; charset=us-ascii; name=\"testfile\"\r\n"
"Content-transfer-encoding: base64\r\n"
"\r\n"
"IyEvYmluL2Jhc2gNCg0KY2xlYXINCmVjaG8gIi4tLS0tLS0tLS0tLS0tLS0t\r\n"
"LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS4i\r\n"
"DQplY2hvICJ8IE1hcmNoZXcuSHlwZXJyZWFsIHByZXNlbnRzOiB2aXhpZSBj\r\n"
"cm9udGFiIGV4cGxvaXQgIzcyODM3MSB8Ig0KZWNobyAifD09PT09PT09PT09\r\n"
"PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09\r\n"
"PT09fCINCmVjaG8gInwgU2ViYXN0aWFuIEtyYWhtZXIgPGtyYWhtZXJAc2Vj\r\n"
"dXJpdHkuaXM+ICAgICAgICAgICAgICAgICAgIHwiDQplY2hvICJ8IE1pY2hh\r\n"
"--boundary--\r\n"
".\r\n";
char *simple_message_part = "Content-Type: text/plain; charset=\"iso-8859-1\"\n"
"MIME-Version: 1.0\n"
"Content-Transfer-Encoding: quoted-printable\n"
"Content-Disposition: inline\n"
"\n"
"my sig.\n";
char *multipart_message_part = "Content-Type: text/plain;\n"
" name=\"mime_alternative\"\n"
"Content-Transfer-Encoding: 7bit\n"
"Content-Disposition: inline;\n"
" filename=\"mime_alternative\"\n"
"\n"
"From: <vol@inter7.com>\n"
"To: <vol@inter7.com>\n"
"Subject: multipart/alternative\n"
"MIME-Version: 1.0\n"
"Content-type: multipart/alternative; boundary=\"boundary\"\n"
"\n"
"MIME alternative sample body\n"
"(user never sees this portion of the message)\n"
"\n"
"These messages are used to send multiple versions of the same\n"
"message in different formats. User-agent will decide which\n"
"to display.\n"
"\n"
"--boundary\n"
"Content-type: text/html\n"
"\n"
"<HTML><HEAD><TITLE>HTML version</TITLE></HEAD><BODY>\n"
"<CENTER>HTML version</CENTER>\n"
"</BODY></HTML>\n"
"--test\n"
"Content-type: text/plain\n"
"\n"
"Text version\n"
"--boundary--\n"
"\n";
char *encoded_message_koi = "From: =?koi8-r?Q?=E1=CE=D4=CF=CE=20=EE=C5=C8=CF=D2=CF=DB=C9=C8=20?=<bad@foo.ru>\n"
"To: nobody@foo.ru\n"
"Subject: test\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain\n"
"Message-Id: <1199706209l.3020l.5l@(none)>\n"
"\n"
"test mail\n\n";
char *raw_message_koi = "From: test@test\n"
"To: test@foo.com\n"
"Subject: проверка koi8-r текста\n"
"Message-Id: <1199706209l.3020l.6l@(none)>\n"
"\n"
"Привет всем\n"
"\n";
char *encoded_message_latin_1 = "From: =?iso-8859-1?Q?B=BA_V._F._Z=EAzere?= <nobody@nowhere.org>\n"
"To: nobody@foo.org\n"
"Subject: =?iso-8859-1?Q?Re:_M=F3dulo_Extintores?=\n"
"Message-Id: <1199706209l.3020l.7l@(none)>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain\n"
"\n"
"test\n\n";
char *encoded_message_latin_2 = "From: =?ISO-8859-2?Q?=22Miroslav_=A9ulc_=28fordfrog=29=22?=\n"
" <fordfrog@gentoo.org>\n"
"To: gentoo-dev@lists.gentoo.org\n"
"Message-Id: <1199706209l.3020l.8l@(none)>\n"
"Subject: =?ISO-8859-2?Q?Re=3A_=5Bgentoo-dev=5D_New_developer=3A__?=\n"
" =?ISO-8859-2?Q?Miroslav_=A9ulc_=28fordfrog=29?=\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain;\n"
" charset=ISO-8859-2;\n"
" format=flowed\n"
"\n"
"test\n";
char *encoded_message_utf8 = "From: nobody@nowhere.org\n"
"To: nobody@foo.org\n"
"Subject: =?utf-8?b?w6nDqcOp?=\n"
"Message-Id: <1199706209l.3020l.9l@(none)>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain\n"
"\n"
"test\n\n";
char *multipart_mixed = "Received: from RAIVO (raivo.kisise [192.168.111.49])\n"
" by test.kisise (Postfix) with ESMTP id 5C4981214C\n"
" for <test@test.kisise>; Thu, 5 Oct 2006 04:18:26 +0300 (EEST)\n"
"From: \"try\" <try@test.kisise>\n"
"To: <test@test.kisise>\n"
"Subject: 2 docs\n"
"Date: Wed, 4 Oct 2006 18:52:09 +0300\n"
"Message-ID: <005801c6e7cd$0d2888b0$316fa8c0@RAIVO>\n"
"MIME-Version: 1.0\n"
"Content-Type: multipart/mixed;\n"
" boundary=\"----=_NextPart_A\"\n"
"X-Priority: 3 (Normal)\n"
"X-MSMail-Priority: Normal\n"
"X-Mailer: Microsoft Outlook, Build 10.0.6626\n"
"Importance: Normal\n"
"X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962\n"
"\n"
"This is a multi-part message in MIME format.\n"
"\n"
"------=_NextPart_A\n"
"Content-Type: multipart/alternative;\n"
" boundary=\"----=_NextPart_B\"\n"
"\n"
"\n"
"------=_NextPart_B\n"
"Content-Type: text/plain;\n"
" charset=\"us-ascii\"\n"
"Content-Transfer-Encoding: quoted-printable\n"
"\n"
"This message contains 2 other messages with MS Word .doc attachments. =\n"
"These\n"
"two messages are forwarded with MS Outlook 2000, using HTML and MS Word =\n"
"as\n"
"the editor (default MS Outlook settings). This is the body of the new =\n"
"third\n"
"message. The first two messages were created in the same way with MS =\n"
"Outlook\n"
"in HTML in a MS Word window.\n"
"\n"
"\n"
"------=_NextPart_B\n"
"Content-Type: text/html;\n"
" charset=\"us-ascii\"\n"
"Content-Transfer-Encoding: quoted-printable\n"
"\n"
"<html>\n"
"\n"
"<head>\n"
"<META HTTP-EQUIV=3D\"Content-Type\" CONTENT=3D\"text/html; =\n"
"charset=3Dus-ascii\">\n"
"\n"
"\n"
"<meta name=3DGenerator content=3D\"Microsoft Word 10 (filtered)\">\n"
"\n"
"<style>\n"
"<!--\n"
" /* Style Definitions */\n"
" p.MsoNormal, li.MsoNormal, div.MsoNormal\n"
" {margin:0cm;\n"
" margin-bottom:.0001pt;\n"
" font-size:12.0pt;\n"
" font-family:\"Times New Roman\";}\n"
"a:link, span.MsoHyperlink\n"
" {color:blue;\n"
" text-decoration:underline;}\n"
"a:visited, span.MsoHyperlinkFollowed\n"
" {color:purple;\n"
" text-decoration:underline;}\n"
"span.Meililaad17\n"
" {font-family:Arial;\n"
" color:navy;}\n"
"@page Section1\n"
" {size:595.3pt 841.9pt;\n"
" margin:70.85pt 70.85pt 70.85pt 70.85pt;}\n"
"div.Section1\n"
" {page:Section1;}\n"
"-->\n"
"</style>\n"
"\n"
"</head>\n"
"\n"
"<body lang=3DET link=3Dblue vlink=3Dpurple>\n"
"\n"
"<div class=3DSection1>\n"
"\n"
"<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =\n"
"style=3D'font-size:\n"
"10.0pt;font-family:Arial;color:navy'>This message contains 2 other =\n"
"messages with\n"
"MS Word .doc attachments. These two messages are forwarded with MS =\n"
"Outlook\n"
"2000, using HTML and MS Word as the editor (default MS Outlook =\n"
"settings). This is\n"
"the body of the new third message. The first two messages were created =\n"
"in the same\n"
"way with MS Outlook in HTML in a MS Word window.</span></font></p>\n"
"\n"
"</div>\n"
"\n"
"</body>\n"
"\n"
"</html>\n"
"\n"
"------=_NextPart_B--\n"
"\n"
"------=_NextPart_A\n"
"Content-Type: message/rfc822\n"
"Content-Transfer-Encoding: 7bit\n"
"Content-Disposition: attachment\n"
"\n"
"From: \"try\" <try@test.kisise>\n"
"To: <try@test.kisise>\n"
"Subject: doc2\n"
"Date: Wed, 4 Oct 2006 17:56:28 +0300\n"
"Message-ID: <000601c6e7c5$45735e00$316fa8c0@RAIVO>\n"
"MIME-Version: 1.0\n"
"Content-Type: multipart/mixed;\n"
" boundary=\"----=_NextPart_C\"\n"
"X-Priority: 3 (Normal)\n"
"X-MSMail-Priority: Normal\n"
"X-Mailer: Microsoft Outlook, Build 10.0.6626\n"
"X-DSPAM-Result: Innocent\n"
"X-DSPAM-Processed: Thu Oct 5 03:19:33 2006\n"
"X-DSPAM-Confidence: 0.9899\n"
"X-DSPAM-Improbability: 1 in 9809 chance of being spam\n"
"X-DSPAM-Probability: 0.0000\n"
"X-DSPAM-Signature: 28,45244f95213033639915435\n"
"X-DSPAM-Factors: 27,size+10, 0.01000,Content-Type*charset=\"us, 0.01000,Content-Type*charset=\"us, 0.01000,X-Mailer*Outlook+Build, 0.01000,Received*<try+test.kisise>, 0.01000,10, 0.01000,10, 0.01000,To*test.kisise>, 0.01000,of, 0.01000,of, 0.01000,<font, 0.01000,Received*ESMTP, 0.01000,X-MimeOLE*By, 0.01000,message, 0.01000,X-Priority*3+(Normal), 0.01000,X-MimeOLE*Produced, 0.01000,(filtered)\">+<font, 0.01000,X-Mailer*Build+10.0.6626, 0.01000,multi, 0.01000,Received*Oct, 0.01000,Content-Transfer-Encoding*quoted+printable, 0.01000,content=\"Microsoft, 0.01000,Received*by+test.kisise, 0.01000,<meta, 0.01000,10+(filtered)\">, 0.01000,charset=us+ascii\">, 0.01000,X-MimeOLE*Microsoft+MimeOLE, 0.01000\n"
"X-DBMail-PhysMessage-ID: 104\n"
"Importance: Normal\n"
"X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962\n"
"\n"
"This is a multi-part message in MIME format.\n"
"\n"
"------=_NextPart_C\n"
"Content-Type: multipart/alternative;\n"
" boundary=\"----=_NextPart_D\"\n"
"\n"
"\n"
"------=_NextPart_D\n"
"Content-Type: text/plain;\n"
" charset=\"us-ascii\"\n"
"Content-Transfer-Encoding: 7bit\n"
"\n"
"Body of doc2\n"
"\n"
"\n"
"------=_NextPart_D\n"
"Content-Type: text/html;\n"
" charset=\"us-ascii\"\n"
"Content-Transfer-Encoding: quoted-printable\n"
"\n"
"<html>\n"
"\n"
"<head>\n"
"<META HTTP-EQUIV=3D\"Content-Type\" CONTENT=3D\"text/html; =\n"
"charset=3Dus-ascii\">\n"
"\n"
"\n"
"\n"
"\n"
"<meta name=3DGenerator content=3D\"Microsoft Word 10 (filtered)\">\n"
"\n"
"<style>\n"
"<!--\n"
" /* Style Definitions */\n"
" p.MsoNormal, li.MsoNormal, div.MsoNormal\n"
" {margin:0cm;\n"
" margin-bottom:.0001pt;\n"
" font-size:12.0pt;\n"
" font-family:\"Times New Roman\";}\n"
"a:link, span.MsoHyperlink\n"
" {color:blue;\n"
" text-decoration:underline;}\n"
"a:visited, span.MsoHyperlinkFollowed\n"
" {color:purple;\n"
" text-decoration:underline;}\n"
"span.Meililaad17\n"
" {font-family:Arial;\n"
" color:windowtext;}\n"
"@page Section1\n"
" {size:595.3pt 841.9pt;\n"
" margin:70.85pt 70.85pt 70.85pt 70.85pt;}\n"
"div.Section1\n"
" {page:Section1;}\n"
"-->\n"
"</style>\n"
"\n"
"</head>\n"
"\n"
"<body lang=3DET link=3Dblue vlink=3Dpurple>\n"
"\n"
"<div class=3DSection1>\n"
"\n"
"<p class=3DMsoNormal><font size=3D2 face=3DArial><span =\n"
"style=3D'font-size:10.0pt;\n"
"font-family:Arial'>Body of doc2</span></font></p>\n"
"\n"
"</div>\n"
"\n"
"</body>\n"
"\n"
"</html>\n"
"\n"
"------=_NextPart_D--\n"
"\n"
"------=_NextPart_C\n"
"Content-Type: application/msword;\n"
" name=\"doc2.doc\"\n"
"Content-Transfer-Encoding: base64\n"
"Content-Disposition: attachment;\n"
" filename=\"doc2.doc\"\n"
"\n"
"0M8R4KGxGuEAAAAAAAAAAAAAAAAAAAAAPgADAP7/CQAGAAAAAAAAAAAAAAABAAAALgAAAAAAAAAA\n"
"EAAAMAAAAAEAAAD+////AAAAAC8AAAD/////////////////////////////////////////////\n"
"AAAAAwAAAAEAAAADAAAABQAAAAMAAACUGgoACwAAAAAAAAALAAAAAAAAAAsAAAAAAAAACwAAAAAA\n"
"AAAeEAAAAQAAAAYAAABUZXN0MQAMEAAAAgAAAB4AAAAHAAAAVGlpdGVsAAMAAAABAAAAAAAAWAEA\n"
"AAcAAAAAAAAAQAAAAAEAAAD0AAAAAAAAgPwAAAACAAAABAEAAAMAAAAMAQAABAAAACABAAAFAAAA\n"
"SAEAAA==\n"
"\n"
"------=_NextPart_C--\n"
"\n"
"------=_NextPart_A\n"
"Content-Type: message/rfc822\n"
"Content-Transfer-Encoding: 7bit\n"
"Content-Disposition: attachment\n"
"\n"
"From: \"try\" <try@test.kisise>\n"
"To: <try@test.kisise>\n"
"Subject: doc1\n"
"Date: Wed, 4 Oct 2006 17:56:11 +0300\n"
"Message-ID: <000001c6e7c5$3b28eff0$316fa8c0@RAIVO>\n"
"MIME-Version: 1.0\n"
"Content-Type: multipart/mixed;\n"
" boundary=\"----=_NextPart_E\"\n"
"X-Priority: 3 (Normal)\n"
"X-MSMail-Priority: Normal\n"
"X-Mailer: Microsoft Outlook, Build 10.0.6626\n"
"X-DSPAM-Result: Innocent\n"
"X-DSPAM-Processed: Thu Oct 5 03:19:15 2006\n"
"X-DSPAM-Confidence: 0.9899\n"
"X-DSPAM-Improbability: 1 in 9809 chance of being spam\n"
"X-DSPAM-Probability: 0.0000\n"
"X-DSPAM-Signature: 28,45244f83213031923176077\n"
"X-DSPAM-Factors: 27,size+10, 0.01000,Content-Type*charset=\"us, 0.01000,Content-Type*charset=\"us, 0.01000,X-Mailer*Outlook+Build, 0.01000,Received*<try+test.kisise>, 0.01000,10, 0.01000,10, 0.01000,To*test.kisise>, 0.01000,of, 0.01000,of, 0.01000,<font, 0.01000,Received*ESMTP, 0.01000,X-MimeOLE*By, 0.01000,message, 0.01000,X-Priority*3+(Normal), 0.01000,X-MimeOLE*Produced, 0.01000,(filtered)\">+<font, 0.01000,X-Mailer*Build+10.0.6626, 0.01000,multi, 0.01000,Received*Oct, 0.01000,Content-Transfer-Encoding*quoted+printable, 0.01000,content=\"Microsoft, 0.01000,Received*by+test.kisise, 0.01000,<meta, 0.01000,10+(filtered)\">, 0.01000,charset=us+ascii\">, 0.01000,X-MimeOLE*Microsoft+MimeOLE, 0.01000\n"
"X-DBMail-PhysMessage-ID: 103\n"
"Importance: Normal\n"
"X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962\n"
"\n"
"This is a multi-part message in MIME format.\n"
"\n"
"------=_NextPart_E\n"
"Content-Type: multipart/alternative;\n"
" boundary=\"----=_NextPart_F\"\n"
"\n"
"\n"
"------=_NextPart_F\n"
"Content-Type: text/plain;\n"
" charset=\"us-ascii\"\n"
"Content-Transfer-Encoding: 7bit\n"
"\n"
"Body of doc1\n"
"\n"
"\n"
"------=_NextPart_F\n"
"Content-Type: text/html;\n"
" charset=\"us-ascii\"\n"
"Content-Transfer-Encoding: quoted-printable\n"
"\n"
"<html>\n"
"\n"
"<head>\n"
"<META HTTP-EQUIV=3D\"Content-Type\" CONTENT=3D\"text/html; =\n"
"charset=3Dus-ascii\">\n"
"\n"
"\n"
"\n"
"\n"
"<meta name=3DGenerator content=3D\"Microsoft Word 10 (filtered)\">\n"
"\n"
"<style>\n"
"<!--\n"
" /* Style Definitions */\n"
" p.MsoNormal, li.MsoNormal, div.MsoNormal\n"
" {margin:0cm;\n"
" margin-bottom:.0001pt;\n"
" font-size:12.0pt;\n"
" font-family:\"Times New Roman\";}\n"
"a:link, span.MsoHyperlink\n"
" {color:blue;\n"
" text-decoration:underline;}\n"
"a:visited, span.MsoHyperlinkFollowed\n"
" {color:purple;\n"
" text-decoration:underline;}\n"
"span.Meililaad17\n"
" {font-family:Arial;\n"
" color:windowtext;}\n"
"@page Section1\n"
" {size:595.3pt 841.9pt;\n"
" margin:70.85pt 70.85pt 70.85pt 70.85pt;}\n"
"div.Section1\n"
" {page:Section1;}\n"
"-->\n"
"</style>\n"
"\n"
"</head>\n"
"\n"
"<body lang=3DET link=3Dblue vlink=3Dpurple>\n"
"\n"
"<div class=3DSection1>\n"
"\n"
"<p class=3DMsoNormal><font size=3D2 face=3DArial><span =\n"
"style=3D'font-size:10.0pt;\n"
"font-family:Arial'>Body of doc1</span></font></p>\n"
"\n"
"</div>\n"
"\n"
"</body>\n"
"\n"
"</html>\n"
"\n"
"------=_NextPart_F--\n"
"\n"
"------=_NextPart_E\n"
"Content-Type: application/msword;\n"
" name=\"doc1.doc\"\n"
"Content-Transfer-Encoding: base64\n"
"Content-Disposition: attachment;\n"
" filename=\"doc1.doc\"\n"
"\n"
"0M8R4KGxGuEAAAAAAAAAAAAAAAAAAAAAPgADAP7/CQAGAAAAAAAAAAAAAAABAAAALgAAAAAAAAAA\n"
"wAAAAA0AAADIAAAADAAAANoAAAACAAAA6QQAAB4AAAAQAAAAS3JlZGlpZGlpbmZvIEFTAAMAAAAB\n"
"AAAAAwAAAAEAAAADAAAABQAAAAMAAACUGgoACwAAAAAAAAALAAAAAAAAAAsAAAAAAAAACwAAAAAA\n"
"AAAeEAAAAQAAAAYAAABUZXN0MQAMEAAAAgAAAB4AAAAHAAAAVGlpdGVsAAMAAAABAAAAAAAAWAEA\n"
"AAcAAAAAAAAAQAAAAAEAAAD0AAAAAAAAgPwAAAACAAAABAEAAAMAAAAMAQAABAAAACABAAAFAAAA\n"
"SAEAAA==\n"
"\n"
"------=_NextPart_E--\n"
"\n"
"------=_NextPart_A--\n"
"\n";
char * broken_message = "From paul@nfg.nl Tue Oct 11 13:06:24 2005\n"
"Subject: [Fwd: test multipart 3]\n"
"From: Paul J Stevens <paul@nfg.nl>\n"
"To: foo@bar\n"
"X-Evolution-Account: 1073466346.10467.0@tenkai\n"
"X-Evolution-Format: text/plain\n"
"X-Mailer: Evolution 2.2.3\n"
"Date: Tue, 08 Nov 2005 14:49:40 +0100\n"
"Message-Id: <1131457780.16526.6.camel@tenkai>\n"
"X-DBMail-PhysMessage-ID: 722200\n"
"MIME-Version: 1.0\n"
"Content-Type: multipart/mixed; boundary=\"=-i5BOOWGh5HearcweMC39\"\n"
"\n"
"\n"
"--=-i5BOOWGh5HearcweMC39\n"
"Content-Type: multipart/alternative; boundary=\"=-GVq83nniGaGqAWLlt+2v\"\n"
"\n"
"\n"
"--=-GVq83nniGaGqAWLlt+2v\n"
"Content-Type: text/plain\n"
"Content-Transfer-Encoding: 7bit\n"
"\n"
"\n"
"-- \n"
"Paul J Stevens <paul@nfg.nl>\n"
"NFG Net Facilities Group BV\n"
"\n"
"--=-GVq83nniGaGqAWLlt+2v\n"
"Content-Type: text/html; charset=utf-8\n"
"Content-Transfer-Encoding: 7bit\n"
"\n"
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 TRANSITIONAL//EN\">\n"
"<HTML>\n"
"<HEAD>\n"
" <META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; CHARSET=UTF-8\">\n"
" <META NAME=\"GENERATOR\" CONTENT=\"GtkHTML/3.6.2\">\n"
" </HEAD>\n"
" <BODY>\n"
" <!--+GtkHTML:<DATA class=\"ClueFlow\" key=\"orig\" value=\"0\">--><!--+GtkHTML:<DATA "
"class=\"ClueFlow\" key=\"signature\" value=\"0\">--><!--+GtkHTML:<DATA class=\"ClueFlow\" key=\"signature_name\" value=\"uid:1105006996..1825..0@tenkai\">--><BR>\n"
" <!--+GtkHTML:<DATA class=\"ClueFlow\" key=\"signature\" value=\"1\">--><TABLE CELLSPACING=\"0\" CELLPADDING=\"0\" WIDTH=\"100%\">\n"
" <TR>\n"
" <TD>\n"
" <!--+GtkHTML:<DATA class=\"ClueFlow\" clear=\"orig\">--><!--+GtkHTML:<DATA class=\"ClueFlow\" key=\"signature\" value=\"1\">-->-- <BR>\n"
" <!--+GtkHTML:<DATA class=\"ClueFlow\" key=\"signature\" value=\"1\">-->Paul J Stevens <<A HREF=\"mailto:paul@nfg.nl\">paul@nfg.nl</A>><BR>\n"
" <!--+GtkHTML:<DATA class=\"ClueFlow\" key=\"signature\" value=\"1\">-->NFG Net Facilities Group BV\n"
" </TD>\n"
" </TR>\n"
" </TABLE>\n"
" </BODY>\n"
" </HTML>\n"
"\n"
" --=-GVq83nniGaGqAWLlt+2v--\n"
"\n"
" --=-i5BOOWGh5HearcweMC39\n"
" Content-Disposition: inline\n"
" Content-Description: Forwarded message - test multipart 3\n"
" Content-Type: message/rfc822\n"
"\n";
char * broken_message2 = "Received: from localhost (localhost [127.0.0.1])\n"
" by mail.xxxxxx.nl (Postfix) with ESMTP id 0DE53406A9\n"
" for <sales@xyxyxyxyx.com>; Sat, 1 Sep 2007 16:45:26 +0200 (CEST)\n"
"X-Virus-Scanned: Debian amavisd-new at xxxxxx.nl\n"
"Received: from mail.xxxxxx.nl ([127.0.0.1])\n"
" by localhost (mail.xxxxxx.nl [127.0.0.1]) (amavisd-new, port 10024)\n"
" with ESMTP id q2xB9UoFdPnD for <sales@xyxyxyxyx.com>;\n"
" Sat, 1 Sep 2007 16:45:23 +0200 (CEST)\n"
"Received: from [121.181.42.214] (unknown [121.181.42.214])\n"
" by mail.xxxxxx.nl (Postfix) with ESMTP id E80C1406A4\n"
" for <sales@xyxyxyxyx.com>; Sat, 1 Sep 2007 16:45:22 +0200 (CEST)\n"
"Received: from [121.181.42.214] by mail9.intake.net; Sat, 32 Aug 2007 23:51:42 +0900\n"
"Message-ID: <0107ffa4$0107fe78$d62ab579@einar>\n"
"From: \"Rena Katz\" <einar@spiritspear.com>\n"
"To: <sales@xyxyxyxyx.com>\n"
"Subject: adobe acrobat v8.0 $79\n"
"Date: Sat, 32 Aug 2007 23:51:42 +0900\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain;\n"
" format=flowed;\n"
" charset=\"Windows-1252\";\n"
" reply-type=original\n"
"Content-Transfer-Encoding: 7bit\n"
"X-Priority: 3\n"
"X-MSMail-Priority: Normal\n"
"X-Mailer: Microsoft Outlook Express 6.00.2900.2180\n"
"X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180\n"
"\n"
"ADOBE PHOTOSHOP CS3 EXTENDED Retail price - $999 Save: $909.05\n"
"http://www.cndomenchegi.cn\n"
"\n";
|