]> diplodocus.org Git - nmh/blob - test/mhfixmsg/test-mhfixmsg
Added -decodetypes switch to mhfixmsg(1).
[nmh] / test / mhfixmsg / test-mhfixmsg
1 #!/bin/sh
2 ######################################################
3 #
4 # Test mhfixmsg
5 #
6 ######################################################
7
8 set -e
9
10 if test -z "${MH_OBJ_DIR}"; then
11 srcdir=`dirname $0`/../..
12 MH_OBJ_DIR=`cd $srcdir && pwd`; export MH_OBJ_DIR
13 fi
14
15 . "${MH_OBJ_DIR}/test/common.sh"
16
17 setup_test
18
19 #### Make sure that html-to-text conversion is what we expect.
20 require_locale en_US.utf-8 en_US.utf8
21 LC_ALL=en_US.UTF-8; export LC_ALL
22
23 expected="$MH_TEST_DIR/test-mhfixmsg$$.expected"
24 expected_err="$MH_TEST_DIR/test-mhfixmsg$$.expected_err"
25 actual="$MH_TEST_DIR/test-mhfixmsg$$.actual"
26 actual_err="$MH_TEST_DIR/test-mhfixmsg$$.actual_err"
27
28 mhn_defaults="$MH_INST_DIR${nmhetcdir}/mhn.defaults"
29
30 if grep mhfixmsg-format-text/html "${mhn_defaults}" \
31 >/dev/null; then
32 can_reformat_texthtml=1
33 if grep 'mhfixmsg-format-text/html.*w3m' "${mhn_defaults}" \
34 >/dev/null; then
35 #### w3m uses $HOME/.w3m/, and creates it if it doesn't exist. To
36 #### support testing with non-writeable $HOME, and to not leave
37 #### relics from this test if it is writeable but doesn't already
38 #### have a .w3m, and to not depend on whatever is in that if it
39 #### does already exist, overwrite $HOME if using w3m.
40 HOME="$MHTMPDIR"; export HOME
41 fi
42 else
43 echo "$0: skipping -reformat check because no text browser was found"
44 can_reformat_texthtml=0
45 fi
46
47
48 # check -help
49 cat >"$expected" <<EOF
50 Usage: mhfixmsg [+folder] [msgs] [switches]
51 switches are:
52 -decodetext 8bit|7bit
53 -nodecodetext
54 -decodetypes
55 -[no]textcharset
56 -[no]reformat
57 -[no]replacetextplain
58 -[no]fixboundary
59 -[no]fixcte
60 -fixtype mimetype
61 -file file
62 -outfile file
63 -rmmproc program
64 -normmproc
65 -[no]changecur
66 -[no]verbose
67 -version
68 -help
69 EOF
70
71 run_prog mhfixmsg -help >"$actual" 2>&1
72 check "$expected" "$actual"
73
74
75 # check -version
76 case `mhfixmsg -version` in
77 mhfixmsg\ --*) ;;
78 *) printf '%s: mhfixmsg -version generated unexpected output\n' "$0" >&2
79 failed=`expr ${failed:-0} + 1`;;
80 esac
81
82
83 # check that non-MIME messages aren't modified
84 # check -outfile
85 run_test 'mhfixmsg first -outfile '"$actual" ''
86 check "`mhpath first`" "$actual" 'keep first'
87
88
89 # check that non-MIME messages with no bodies aren't modified
90 # check -outfile
91 cat >`mhpath new` <<EOF
92 From: Test <test@example.com>
93 To: Some User <user@example.com>
94 Date: Fri, 29 Sep 2006 00:00:00
95 Message-Id: @test.nmh
96 Subject: message with no body
97 EOF
98
99 run_test 'mhfixmsg last -outfile '"$actual" ''
100 check "`mhpath last`" "$actual"
101
102
103 # check -nofixcte
104 cat >"$MH_TEST_DIR"/Mail/inbox/11 <<EOF
105 From: Anon
106 To: Mailinglist
107 Subject: =?ISO-8859-15?Q?Re=3A_H=E5lla_linuxsystem_uppdaterade?=
108 User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
109 MIME-Version: 1.0
110 Content-Type: MULTIPART/MIXED;
111 BOUNDARY="----=_NextPart_000_0000_00000000.00000000"
112 Content-Transfer-Encoding: QUOTED-PRINTABLE
113
114 This message is in MIME format. The first part should be readable
115 text,
116 while the remaining parts are likely unreadable without MIME-aware
117 tools.
118
119 ------=_NextPart_000_0000_00000000.00000000
120 Content-Type: TEXT/PLAIN; CHARSET=ISO-8859-15
121 Content-Transfer-Encoding: 8BIT
122
123 Some text in swedish.
124
125 Varf=C3=B6r inte anv=C3=A4nda...
126
127 ------=_NextPart_000_0000_00000000.00000000--
128
129 And some text after the last part.
130 EOF
131
132 cp -p "$MH_TEST_DIR"/Mail/inbox/11 "$MH_TEST_DIR"/Mail/inbox/12
133
134 run_test 'mhfixmsg last -nofixcte' ''
135 check "$MH_TEST_DIR"/Mail/inbox/11 "$MH_TEST_DIR"/Mail/inbox/12 'keep first'
136
137
138 # check -fixcte (enabled by default): fixup of erroneous C-T-E in multipart
139 # check -verbose
140 cat >"$expected" <<EOF
141 From: Anon
142 To: Mailinglist
143 Subject: =?ISO-8859-15?Q?Re=3A_H=E5lla_linuxsystem_uppdaterade?=
144 User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
145 MIME-Version: 1.0
146 Content-Type: MULTIPART/MIXED;
147 BOUNDARY="----=_NextPart_000_0000_00000000.00000000"
148 Nmh-REPLACED-INVALID-Content-Transfer-Encoding: QUOTED-PRINTABLE
149 Content-Transfer-Encoding: 8bit
150
151 This message is in MIME format. The first part should be readable
152 text,
153 while the remaining parts are likely unreadable without MIME-aware
154 tools.
155
156 ------=_NextPart_000_0000_00000000.00000000
157 Content-Type: TEXT/PLAIN; CHARSET=ISO-8859-15
158 Content-Transfer-Encoding: 8BIT
159
160 Some text in swedish.
161
162 Varf=C3=B6r inte anv=C3=A4nda...
163
164 ------=_NextPart_000_0000_00000000.00000000--
165
166 And some text after the last part.
167 EOF
168
169 run_test 'mhfixmsg last -outfile '"$actual"' -verbose' \
170 "mhfixmsg: 11, replace Content-Transfer-Encoding of \
171 QUOTED-PRINTABLE with 8 bit"
172 check "$expected" "$actual" 'keep first'
173
174
175 # check with no options: checks backup
176 cp "$MH_TEST_DIR"/Mail/inbox/11 "$MH_TEST_DIR"/Mail/inbox/11.original
177 folder last >/dev/null
178 run_test 'mhfixmsg' ''
179 check "$expected" "$MH_TEST_DIR"/Mail/inbox/11 'keep first'
180 cp "$MH_TEST_DIR"/Mail/inbox/11.original "$MH_TEST_DIR"/Mail/inbox/11
181 check "$MH_TEST_DIR"/Mail/inbox/,11 "$MH_TEST_DIR"/Mail/inbox/11.original
182
183
184 # check backup with -file
185 cp "$MH_TEST_DIR"/Mail/inbox/11 "$MH_TEST_DIR"/Mail/inbox/11.original
186 folder last >/dev/null
187 run_test 'mhfixmsg -file '"$MH_TEST_DIR"/Mail/inbox/11 ''
188 check "$MH_TEST_DIR"/Mail/inbox/11 "$expected" 'keep first'
189 check "$MH_TEST_DIR"/Mail/inbox/,11 "$MH_TEST_DIR"/Mail/inbox/11.original
190
191
192 # check -reformat (enabled by default): addition of text/plain part
193 # to solitary text/html part
194 #
195 prepare_space >"$expected" <<EOF
196 MIME-Version: 1.0
197 From: sender@example.com
198 To: bonquiqui@example.com
199 Subject: rue
200 Date: Sat, 26 Jan 2013 17:37:53 -0500
201 Content-Type: multipart/alternative; boundary="----=_nmh-multipart"
202
203 ------=_nmh-multipart
204 Content-Type: text/plain; charset="Windows-1252"
205 Content-Transfer-Encoding: 8bit
206
207 Need to go! Need ... to ... go!
208
209 ------=_nmh-multipart
210 Content-Type: text/html; charset="Windows-1252"
211 Content-Transfer-Encoding: 8bit
212
213 <html>
214 <head>
215 <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
216 <meta name="Generator" content="Microsoft Exchange Server">
217 <!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
218 </head>
219 <body>
220 <div>
221 <div>Need to go! Need ... to ... go!</div>
222 </body>
223 </html>
224
225 ------=_nmh-multipart--
226 EOF
227
228 cat >"$MH_TEST_DIR"/Mail/inbox/12 <<EOF
229 MIME-Version: 1.0
230 From: sender@example.com
231 To: bonquiqui@example.com
232 Subject: rue
233 Date: Sat, 26 Jan 2013 17:37:53 -0500
234 Content-Type: text/html; charset="Windows-1252"
235 Content-Transfer-Encoding: quoted-printable
236
237 <html>
238 <head>
239 <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DWindows-1=
240 252">
241 <meta name=3D"Generator" content=3D"Microsoft Exchange Server">
242 <!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; pad=
243 ding-left: 4pt; border-left: #800000 2px solid; } --></style>
244 </head>
245 <body>
246 <div>
247 <div>Need to go! Need ... to ... go!</div>
248 </body>
249 </html>
250 EOF
251
252 if [ $can_reformat_texthtml -eq 1 ]; then
253 printf '%s\n' "mhfixmsg: 12, insert text/plain part
254 mhfixmsg: 12 part 1, decode text/html; charset=\"Windows-1252\"" \
255 >"$expected.err"
256
257 #### lynx inserts multiple blank lines, so squeeze them.
258 run_prog mhfixmsg last -outfile - -verbose 2>"$actual.err" | \
259 squeeze_lines >"$actual"
260 check "$expected" "$actual" 'ignore space'
261 check "$expected.err" "$actual.err"
262 else
263 rm -f "$expected"
264 fi
265
266
267 # check implicit -file with absolute pathname
268 run_test "mhfixmsg `mhpath last` -outfile /dev/null" ''
269
270
271 # check handling of boundary string that appears in message body
272 #
273 prepare_space >"$expected" <<EOF
274 MIME-Version: 1.0
275 From: sender@example.com
276 To: bonquiqui@example.com
277 Subject: rue
278 Date: Sat, 26 Jan 2013 17:37:53 -0500
279 Content-Type: multipart/alternative; boundary="----=_nmh-multipart-3"
280
281 ------=_nmh-multipart-3
282 Content-Type: text/plain; charset="Windows-1252"
283 Content-Transfer-Encoding: 8bit
284
285 ------=_nmh-multipart
286 ------=_nmh-multipart-1
287 ------=_nmh-multipart-2
288
289 ------=_nmh-multipart-3
290 Content-Type: text/html; charset="Windows-1252"
291 Content-Transfer-Encoding: 8bit
292
293 <html>
294 <head>
295 <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
296 <meta name="Generator" content="Microsoft Exchange Server">
297 <!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
298 </head>
299 <body>
300 ------=_nmh-multipart<br>
301 ------=_nmh-multipart-1<br>
302 ------=_nmh-multipart-2<br>
303 </body>
304 </html>
305
306 ------=_nmh-multipart-3--
307 EOF
308
309 cat >"$MH_TEST_DIR"/Mail/inbox/12 <<EOF
310 MIME-Version: 1.0
311 From: sender@example.com
312 To: bonquiqui@example.com
313 Subject: rue
314 Date: Sat, 26 Jan 2013 17:37:53 -0500
315 Content-Type: text/html; charset="Windows-1252"
316 Content-Transfer-Encoding: quoted-printable
317
318 <html>
319 <head>
320 <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DWindows-1=
321 252">
322 <meta name=3D"Generator" content=3D"Microsoft Exchange Server">
323 <!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; pad=
324 ding-left: 4pt; border-left: #800000 2px solid; } --></style>
325 </head>
326 <body>
327 ------=3D_nmh-multipart<br>
328 ------=3D_nmh-multipart-1<br>
329 ------=3D_nmh-multipart-2<br>
330 </body>
331 </html>
332 EOF
333
334 if [ $can_reformat_texthtml -eq 1 ]; then
335 printf '%s\n' "mhfixmsg: 12, insert text/plain part
336 mhfixmsg: 12 part 1, decode text/html; charset=\"Windows-1252\"" \
337 >"$expected.err"
338
339 #### lynx inserts multiple blank lines, so squeeze them.
340 run_prog mhfixmsg last -outfile - -verbose 2>"$actual.err" | \
341 squeeze_lines >"$actual"
342 check "$expected" "$actual" 'ignore space'
343 check "$expected.err" "$actual.err"
344 else
345 rm -f "$expected"
346 fi
347
348
349 # check -nodecode
350 prepare_space >"$expected" <<EOF
351 MIME-Version: 1.0
352 From: sender@example.com
353 To: bonquiqui@example.com
354 Subject: rue
355 Date: Sat, 26 Jan 2013 17:37:53 -0500
356 Content-Type: multipart/alternative; boundary="----=_nmh-multipart"
357
358 ------=_nmh-multipart
359 Content-Type: text/plain; charset="Windows-1252"
360 Content-Transfer-Encoding: 8bit
361
362 Need to go! Need ... to ... go!
363
364 ------=_nmh-multipart
365 Content-Type: text/html; charset="Windows-1252"
366 Content-Transfer-Encoding: quoted-printable
367
368 <html>
369 <head>
370 <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DWindows-=
371 1252">
372 <meta name=3D"Generator" content=3D"Microsoft Exchange Server">
373 <!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; pa=
374 dding-left: 4pt; border-left: #800000 2px solid; } --></style>
375 </head>
376 <body>
377 <div>
378 <div>Need to go! Need ... to ... go!</div>
379 </body>
380 </html>
381
382 ------=_nmh-multipart--
383 EOF
384
385 cat >"$MH_TEST_DIR"/Mail/inbox/12 <<EOF
386 MIME-Version: 1.0
387 From: sender@example.com
388 To: bonquiqui@example.com
389 Subject: rue
390 Date: Sat, 26 Jan 2013 17:37:53 -0500
391 Content-Type: text/html; charset="Windows-1252"
392 Content-Transfer-Encoding: quoted-printable
393
394 <html>
395 <head>
396 <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DWindows-1=
397 252">
398 <meta name=3D"Generator" content=3D"Microsoft Exchange Server">
399 <!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; pad=
400 ding-left: 4pt; border-left: #800000 2px solid; } --></style>
401 </head>
402 <body>
403 <div>
404 <div>Need to go! Need ... to ... go!</div>
405 </body>
406 </html>
407 EOF
408
409 if [ $can_reformat_texthtml -eq 1 ]; then
410 printf '%s\n' 'mhfixmsg: 12, insert text/plain part' >"$expected.err"
411
412 #### lynx inserts multiple blank lines, so squeeze them.
413 run_prog mhfixmsg last -nodecode -outfile - -verbose 2>"$actual.err" | \
414 squeeze_lines >"$actual"
415 check "$expected" "$actual" 'ignore space'
416 check "$expected.err" "$actual.err"
417 else
418 rm -f "$expected"
419 fi
420
421
422 # check -decodetext (enabled by default)
423 cat >"$expected" <<EOF
424 To: recipient@example.com
425 From: sender@example.com
426 Subject: mhfixmsg decode test 1
427 MIME-Version: 1.0
428 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
429
430 ------- =_aaaaaaaaaa0
431 Content-Type: text/plain; charset="iso-8859-1"; name="test4.txt"
432 Content-Disposition: attachment; filename="test4.txt"
433 Content-Transfer-Encoding: 8bit
434
435 This is a text/plain part.
436
437 ------- =_aaaaaaaaaa0--
438 EOF
439
440 cat >`mhpath new` <<EOF
441 To: recipient@example.com
442 From: sender@example.com
443 Subject: mhfixmsg decode test 1
444 MIME-Version: 1.0
445 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
446
447 ------- =_aaaaaaaaaa0
448 Content-Type: text/plain; charset="iso-8859-1"; name="test4.txt"
449 Content-Disposition: attachment; filename="test4.txt"
450 Content-Transfer-Encoding: base64
451
452 VGhpcyBpcyBhIHRleHQvcGxhaW4gcGFydC4K
453
454 ------- =_aaaaaaaaaa0--
455 EOF
456
457 run_prog mhfixmsg last -outfile "$actual"
458 check "$expected" "$actual"
459
460
461 # check -decodetext with more complicated content structure
462 cat >$expected <<EOF
463 To: recipient@example.com
464 From: sender@example.com
465 Subject: mhfixmsg decode test 2
466 MIME-Version: 1.0
467 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
468
469 This is additional content before the first subpart of the multipart.
470
471 ------- =_aaaaaaaaaa0
472 Content-Type: multipart/related;
473 type="text/plain"; boundary="subpart__1.1"
474
475 --subpart__1.1
476 Content-Type: text/plain; charset="iso-8859-1"
477 Content-Disposition: attachment; filename="test1.txt"
478
479 This is the first text/plain part, in a subpart.
480
481 --subpart__1.1--
482
483 This is additional content after the last subpart of the multipart.
484
485 ------- =_aaaaaaaaaa0
486 Content-Type: text/plain; charset="iso-8859-1"
487 Content-Disposition: attachment; filename="test2.txt"
488 Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
489 Content-Transfer-Encoding: 8bit
490
491 This is the second text/plain part.
492
493 ------- =_aaaaaaaaaa0
494 Content-Type: text/plain; charset="iso-8859-1"
495 Content-Disposition: attachment; filename="test3.txt"
496
497 This is the third text/plain part.
498
499 ------- =_aaaaaaaaaa0
500 Content-Type: text/plain; charset="iso-8859-1"; name="test4.txt"
501 Content-Disposition: attachment; filename="test4.txt"
502 Content-Transfer-Encoding: 8bit
503
504 This is the fourth text/plain part.
505
506 ------- =_aaaaaaaaaa0--
507
508 This is additional content after the last subpart of the multipart.
509 EOF
510
511 cat >`mhpath new` <<EOF
512 To: recipient@example.com
513 From: sender@example.com
514 Subject: mhfixmsg decode test 2
515 MIME-Version: 1.0
516 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
517
518 This is additional content before the first subpart of the multipart.
519
520 ------- =_aaaaaaaaaa0
521 Content-Type: multipart/related;
522 type="text/plain"; boundary="subpart__1.1"
523
524 --subpart__1.1
525 Content-Type: text/plain; charset="iso-8859-1"
526 Content-Disposition: attachment; filename="test1.txt"
527
528 This is the first text/plain part, in a subpart.
529
530 --subpart__1.1--
531
532 This is additional content after the last subpart of the multipart.
533
534 ------- =_aaaaaaaaaa0
535 Content-Type: text/plain; charset="iso-8859-1"
536 Content-Disposition: attachment; filename="test2.txt"
537 Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
538 Content-Transfer-Encoding: quoted-printable
539
540 This is the second text/plain part.
541
542 ------- =_aaaaaaaaaa0
543 Content-Type: text/plain; charset="iso-8859-1"
544 Content-Disposition: attachment; filename="test3.txt"
545
546 This is the third text/plain part.
547
548 ------- =_aaaaaaaaaa0
549 Content-Type: text/plain; charset="iso-8859-1"; name="test4.txt"
550 Content-Disposition: attachment; filename="test4.txt"
551 Content-Transfer-Encoding: base64
552
553 VGhpcyBpcyB0aGUgZm91cnRoIHRleHQvcGxhaW4gcGFydC4K
554
555 ------- =_aaaaaaaaaa0--
556
557 This is additional content after the last subpart of the multipart.
558 EOF
559 run_prog mhfixmsg last -outfile "$actual"
560 check "$expected" "$actual"
561
562
563 # check attempted -decodetext of binary text
564 #### Generated the encoded text below with:
565 #### $ printf '\x0\xbd\xb2=\xbc\n' | base64
566 cat >`mhpath new` <<EOF
567 To: recipient@example.com
568 From: sender@example.com
569 Subject: mhfixmsg attempted binary decode test
570 MIME-Version: 1.0
571 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
572
573 ------- =_aaaaaaaaaa0
574 Content-Type: text/plain; charset="iso-8859-1"; name="nul+square.txt"
575 Content-Transfer-Encoding: base64
576
577 AL2yPbwK
578
579 ------- =_aaaaaaaaaa0--
580 EOF
581
582 cp -p `mhpath last` "$expected"
583 run_prog mhfixmsg last
584 check `mhpath last` "$expected" 'keep first'
585
586
587 # check -decodetext of binary text
588 printf "%s\x0d\xbd\xb2=\xbc%s" "To: recipient@example.com
589 From: sender@example.com
590 Subject: mhfixmsg binary decode test
591 MIME-Version: 1.0
592 Content-Type: multipart/mixed; boundary=\"----- =_aaaaaaaaaa0\"
593
594 ------- =_aaaaaaaaaa0
595 Content-Type: text/plain; charset=\"iso-8859-1\"; name=\"nul+square.txt\"
596 Content-Transfer-Encoding: binary
597
598 " "
599
600 ------- =_aaaaaaaaaa0--
601 " >"$expected"
602 ## output_content() in mhoutsbr.c can't handle binary content.
603 ## mhfixmsg last -decodetext binary -outfile "$actual"
604 ## check "$expected" "$actual"
605 rm -f "$expected"
606 rmm last
607
608
609 # check that -reformat succeeds when decode of binary text fails
610 prepare_space >"$expected" <<'EOF'
611 MIME-Version: 1.0
612 Date: Thu, 11 Apr 2013 02:47:08 -0700
613 To: <me@example.com>
614 From: <sender@example.com>
615 Subject: body requires binary encoding
616 Content-Type: multipart/alternative; boundary="----=_nmh-multipart"
617
618 ------=_nmh-multipart
619 Content-Type: text/plain; charset="ISO-8859-1"
620 Content-Transfer-Encoding: 8bit
621
622 Mile $0.00
623 Time $78.71
624 State Tax $5.90
625 Vehicle License Fee $1.84
626 State Txn Tax $6.00
627
628 ------=_nmh-multipart
629 Content-Type: text/html; charset="ISO-8859-1"
630 Content-Transfer-Encoding: quoted-printable
631
632 <body>
633 EOF
634
635 cat >`mhpath new` <<'EOF'
636 MIME-Version: 1.0
637 Content-Type: text/html; charset="ISO-8859-1"
638 Content-Transfer-Encoding: quoted-printable
639 Date: Thu, 11 Apr 2013 02:47:08 -0700
640 To: <me@example.com>
641 From: <sender@example.com>
642 Subject: body requires binary encoding
643
644 <body>
645 <table width=3D"325" border=3D"0" cellspacing=3D"0" cellpadding=3D"0">
646 <tr><td><font face=3D"Arial, Helvetica, sans-serif" color=3D"#333333" size=
647 =3D"2"><strong>Mile</strong></font></td><td height=3D"3">&nbsp;</td><td ali=
648 gn=3D"right"><font face=3D"Arial, Helvetica, sans-serif" color=3D"#333333" =
649 size=3D"2">$0.00</font></td></tr><tr><td><font face=3D"Arial, Helvetica, sa=
650 ns-serif" color=3D"#333333" size=3D"2"><strong>Time</strong></font></td><td=
651 height=3D"3">&nbsp;</td><td align=3D"right"><font face=3D"Arial, Helvetica=
652 , sans-serif" color=3D"#333333" size=3D"2">$78.71</font></td></tr><tr><td><=
653 font face=3D"Arial, Helvetica, sans-serif" color=3D"#333333" size=3D"2"><st=
654 rong>State Tax</strong></font></td><td height=3D"3">&nbsp;</td><td align=3D=
655 "right"><font face=3D"Arial, Helvetica, sans-serif" color=3D"#333333" size=
656 =3D"2">$5.90</font></td></tr><tr><td><font face=3D"Arial, Helvetica, sans-s=
657 erif" color=3D"#333333" size=3D"2"><strong>Vehicle License Fee</strong></fo=
658 nt></td><td height=3D"3">&nbsp;</td><td align=3D"right"><font face=3D"Arial=
659 , Helvetica, sans-serif" color=3D"#333333" size=3D"2">$1.84</font></td></tr=
660 ><tr><td><font face=3D"Arial, Helvetica, sans-serif" color=3D"#333333" size=
661 =3D"2"><strong>State Txn Tax</strong></font></td><td height=3D"3">&nbsp;</t=
662 d><td align=3D"right"><font face=3D"Arial, Helvetica, sans-serif" color=3D"=
663 #333333" size=3D"2">$6.00</font></td></tr>
664
665 </body>
666 </html>
667 EOF
668
669 if [ $can_reformat_texthtml -eq 1 ]; then
670 #### lynx inserts multiple blank lines, so squeeze them.
671 #### Truncate to avoid comparing the html portion because it can
672 #### get reformatted.
673 run_prog mhfixmsg last -outfile - | squeeze_lines | head -22 >"$actual"
674 check "$expected" "$actual" 'ignore space'
675 else
676 cp -p "$MH_TEST_DIR/Mail/inbox/15" "$MH_TEST_DIR/Mail/inbox/15.backup"
677 rm -f "$expected"
678 fi
679
680
681 # check -textcharset
682 # Also checks preservation of attributes after one (charset) that is
683 # modified.
684 cat >"$expected" <<EOF
685 To: recipient@example.com
686 From: sender@example.com
687 Subject: mhfixmsg textcharset test
688 MIME-Version: 1.0
689 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
690
691 ------- =_aaaaaaaaaa0
692 Content-Type: text/plain; charset="utf-8"; name="square.txt"
693 Content-Disposition: attachment; filename="square.txt"
694 Content-Transfer-Encoding: 8bit
695
696 ½²=¼
697
698 ------- =_aaaaaaaaaa0--
699 EOF
700
701 #### Generated the encoded text below with:
702 #### $ printf '\xbd\xb2=\xbc\n' | base64
703 cat >`mhpath new` <<EOF
704 To: recipient@example.com
705 From: sender@example.com
706 Subject: mhfixmsg textcharset test
707 MIME-Version: 1.0
708 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
709
710 ------- =_aaaaaaaaaa0
711 Content-Type: text/plain; charset="iso-8859-1"; name="square.txt"
712 Content-Disposition: attachment; filename="square.txt"
713 Content-Transfer-Encoding: base64
714
715 vbI9vAo=
716
717 ------- =_aaaaaaaaaa0--
718 EOF
719
720 if test "$ICONV_ENABLED" -eq 1; then
721 run_prog mhfixmsg last -textcharset utf-8 -outfile "$actual" 2>&1
722 check "$expected" "$actual"
723 else
724 echo "$0: skipping -textcharset check because nmh was built without iconv"
725 rm -f "$expected"
726 fi
727
728
729 # check -nofixboundary
730 cat >"$expected" <<EOF
731 EOF
732
733 cat >`mhpath new` <<EOF
734 Date: Fri, 13 May 2011 08:21:12 -0500
735 Content-Type: multipart/alternative;
736 boundary="----=_NextPart_000_1781A17_01CC1147.81E9467A"
737 Content-Transfer-Encoding: 8bit
738 MIME-Version: 1.0
739 From: <sender@example.com>
740 To: <recipient@example.com>
741 Subject: mhfixmsg bad boundary test
742
743 This is a multi-part message in MIME format.
744
745 ------=_NextPart_000_1781A1A_01CC1147.81EBA8D4
746 Content-Type: text/plain
747
748 The boundaries of this part don't match the header boundary.
749
750 ------=_NextPart_000_1781A1A_01CC1147.81EBA8D4--
751 EOF
752
753 cp -p `mhpath last` `mhpath new`
754
755 run_test 'mhfixmsg last -nofixboundary' ''
756 check "$MH_TEST_DIR"/Mail/inbox/17 "$MH_TEST_DIR"/Mail/inbox/18 'keep first'
757
758
759 # check that message is not output when fed through stdin
760 run_prog mhfixmsg -file - -verbose <`mhpath last` >"$actual" 2>"$actual.err"
761 check "$expected" "$actual"
762 if grep "mhfixmsg: $MH_TEST_DIR/Mail/.*, fix multipart boundary" \
763 "$actual.err" >/dev/null; then
764 rm -f "$actual.err"
765 else
766 echo "$0: test failed, output is in $actual.err."
767 failed=`expr ${failed:-0} + 1`
768 fi
769
770
771 # check fixup of erroneous boundary in multipart (-fixboundary,
772 # enabled by default)
773 # check -verbose
774 cat >"$expected" <<EOF
775 Date: Fri, 13 May 2011 08:21:12 -0500
776 Content-Type: multipart/alternative;
777 boundary="----=_NextPart_000_1781A1A_01CC1147.81EBA8D4"
778 Content-Transfer-Encoding: 8bit
779 MIME-Version: 1.0
780 From: <sender@example.com>
781 To: <recipient@example.com>
782 Subject: mhfixmsg bad boundary test
783
784 This is a multi-part message in MIME format.
785
786 ------=_NextPart_000_1781A1A_01CC1147.81EBA8D4
787 Content-Type: text/plain
788
789 The boundaries of this part don't match the header boundary.
790
791 ------=_NextPart_000_1781A1A_01CC1147.81EBA8D4--
792 EOF
793
794 run_test 'mhfixmsg last -outfile '"$actual"' -verbose' \
795 "mhfixmsg: 17, fix multipart boundary"
796 check "$expected" "$actual"
797
798
799 # check that text/plain part is not added to text/html in multipart/related
800 # when it shouldn't be
801 cat >`mhpath new` <<EOF
802 MIME-Version: 1.0
803 Date: Tue, 26 Feb 2013 18:07:20 -0600
804 Subject: multipart/related, not /alternative
805 Content-Type: multipart/related;
806 type="text/html"; boundary="----=_Part_90310_101292502.1"
807
808 ------=_Part_90310_101292502.1
809 Content-Type: text/html; charset="us-ascii"
810 Content-Transfer-Encoding: 7bit
811
812 <html><head>
813 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
814 <title>HTML Content</title>
815 </head>
816 <body>
817 This is the real content.
818 </body>
819 </html>
820
821 ------=_Part_90310_101292502.1
822 Content-Type: text/plain; charset="us-ascii"
823 Content-Transfer-Encoding: 7bit
824
825 Your email client does not support HTML messages
826
827 ------=_Part_90310_101292502.1--
828 EOF
829
830 cp -p `mhpath last` "$expected"
831
832 if [ $can_reformat_texthtml -eq 1 ]; then
833 #### lynx inserts multiple blank lines, so squeeze them.
834 run_prog mhfixmsg last -outfile - | squeeze_lines >"$actual"
835 check "$expected" "$actual" 'ignore space'
836 else
837 rm -f "$expected"
838 fi
839
840
841 # check that text/plain part is added to text/html in multipart/related
842 # when it should be
843 cat >"$expected" <<EOF
844 MIME-Version: 1.0
845 Date: Tue, 26 Feb 2013 18:07:20 -0600
846 Subject: multipart/related, not /alternative
847 Content-Type: multipart/alternative; boundary="----=_Part_90310_101292502.1"
848
849 ------=_Part_90310_101292502.1
850 Content-Type: text/plain; charset="us-ascii"
851 Content-Transfer-Encoding: 7bit
852
853 This is the real content.
854
855 ------=_Part_90310_101292502.1
856 Content-Type: text/html; charset="us-ascii"
857 Content-Transfer-Encoding: 7bit
858
859 <html><head>
860 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
861 <title>HTML Content</title>
862 </head>
863 <body>
864 This is the real content.
865 </body>
866 </html>
867
868 ------=_Part_90310_101292502.1--
869 EOF
870
871 cat >`mhpath new` <<EOF
872 MIME-Version: 1.0
873 Date: Tue, 26 Feb 2013 18:07:20 -0600
874 Subject: multipart/related, not /alternative
875 Content-Type: multipart/related;
876 type="text/html"; boundary="----=_Part_90310_101292502.1"
877
878 ------=_Part_90310_101292502.1
879 Content-Type: text/html; charset="us-ascii"
880 Content-Transfer-Encoding: 7bit
881
882 <html><head>
883 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
884 <title>HTML Content</title>
885 </head>
886 <body>
887 This is the real content.
888 </body>
889 </html>
890
891 ------=_Part_90310_101292502.1--
892 EOF
893
894 if [ $can_reformat_texthtml -eq 1 ]; then
895 #### lynx inserts multiple blank lines, so squeeze them.
896 run_prog mhfixmsg last -outfile - | squeeze_lines >"$actual"
897 check "$expected" "$actual" 'ignore space'
898 else
899 rm -f "$expected"
900 fi
901
902
903 # check handling of rfc822 message type
904 cat >"$expected" <<EOF
905 From: Test <test@example.com>
906 To: Some User <user@example.com>
907 Date: Fri, 29 Sep 2006 00:00:00
908 Message-Id: @test.nmh
909 Subject: message with message/rfc822 attachment
910 MIME-Version: 1.0
911 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
912
913 and some garbage before the attachment
914
915 ------- =_aaaaaaaaaa0
916 Content-Type: message/rfc822; name="1552"; charset="us-ascii"
917 Content-Description: 1552
918 Content-Disposition: attachment; filename="1552"
919
920 From: Test <test@example.com>
921 To: <another_user@example.com>
922 Date: Thu, 28 Sep 2006 00:00:00
923 Message-Id: @test.nmh
924 Subject: message/rfc822 attachment
925
926 This is an RFC-822 message.
927
928 ------- =_aaaaaaaaaa0--
929
930 and some garbage at the end
931 EOF
932
933 cat >`mhpath new` <<EOF
934 From: Test <test@example.com>
935 To: Some User <user@example.com>
936 Date: Fri, 29 Sep 2006 00:00:00
937 Message-Id: @test.nmh
938 Subject: message with message/rfc822 attachment
939 MIME-Version: 1.0
940 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaa0"
941
942 and some garbage before the attachment
943
944 ------- =_aaaaaaaaaa0
945 Content-Type: message/rfc822; name="1552"; charset="us-ascii"
946 Content-Description: 1552
947 Content-Disposition: attachment; filename="1552"
948
949 From: Test <test@example.com>
950 To: <another_user@example.com>
951 Date: Thu, 28 Sep 2006 00:00:00
952 Message-Id: @test.nmh
953 Subject: message/rfc822 attachment
954
955 This is an RFC-822 message.
956
957 ------- =_aaaaaaaaaa0--
958
959 and some garbage at the end
960 EOF
961
962 run_test 'mhfixmsg last -outfile '"$actual" ''
963 check "$expected" "$actual"
964
965
966 # check stripping of CRs from ASCII text context
967 cat >"$expected" <<EOF
968 MIME-Version: 1.0
969 From: sender@example.com
970 To: recipient@example.com
971 Subject: message with CR's
972 Date: Mon, 29 Apr 2013 11:51:45 -0400
973
974 There are two CR-LF pairs at the end of this sentence.
975
976 EOF
977
978 cat >`mhpath new` <<'EOF'
979 MIME-Version: 1.0
980 From: sender@example.com
981 To: recipient@example.com
982 Subject: message with CR's
983 Date: Mon, 29 Apr 2013 11:51:45 -0400
984
985 There are two CR-LF pairs at the end of this sentence.
986
987 EOF
988
989 run_prog mhfixmsg last -outfile "$actual"
990 check "$expected" "$actual"
991
992
993 # check -replacetextplain
994 prepare_space >"$expected" <<EOF
995 To: recipient@example.com
996 From: sender@example.com
997 Subject: mhfixmsg replacement of bad text/plain part test
998 MIME-Version: 1.0
999 Content-Type: multipart/alternative; boundary="----=_Part_876302"
1000
1001 ------=_Part_876302
1002 Content-Type: text/plain; charset="UTF-8"
1003 Content-Transfer-Encoding: 8bit
1004
1005 Yes, the text/plain part really was empty.
1006
1007 ------=_Part_876302
1008 Content-Type: text/html; charset="UTF-8"
1009 Content-Transfer-Encoding: 8bit
1010 Content-Disposition: inline
1011
1012 <html><head>
1013 <title>eticket</title>
1014 </head>
1015 <body>
1016 Yes, the text/plain part really was empty.
1017 </body>
1018 </html>
1019
1020 ------=_Part_876302--
1021 EOF
1022
1023 cat >`mhpath new` <<'EOF'
1024 To: recipient@example.com
1025 From: sender@example.com
1026 Subject: mhfixmsg replacement of bad text/plain part test
1027 MIME-Version: 1.0
1028 Content-Type: multipart/alternative; boundary="----=_Part_876302"
1029
1030 ------=_Part_876302
1031 Content-Type: text/plain; charset="iso-8859-15"
1032 Content-Transfer-Encoding: 7bit
1033 Content-Disposition: inline
1034
1035
1036
1037 ------=_Part_876302
1038 Content-Type: text/html; charset="UTF-8"
1039 Content-Transfer-Encoding: 8bit
1040 Content-Disposition: inline
1041
1042 <html><head>
1043 <title>eticket</title>
1044 </head>
1045 <body>
1046 Yes, the text/plain part really was empty.
1047 </body>
1048 </html>
1049
1050 ------=_Part_876302--
1051 EOF
1052
1053 if [ $can_reformat_texthtml -eq 1 ]; then
1054 #### lynx inserts multiple blank lines, so squeeze them.
1055 run_prog mhfixmsg last -replacetextplain -outfile - | \
1056 squeeze_lines > "$actual"
1057 check "$expected" "$actual" 'ignore space'
1058 else
1059 rm -f "$expected"
1060 fi
1061
1062
1063 # check -noreplacetextplain
1064 cat >"$expected" <<EOF
1065 To: recipient@example.com
1066 From: sender@example.com
1067 Subject: mhfixmsg replacement of bad text/plain part test
1068 MIME-Version: 1.0
1069 Content-Type: multipart/alternative; boundary="----=_Part_876302"
1070
1071 ------=_Part_876302
1072 Content-Type: text/plain; charset="iso-8859-15"
1073 Content-Transfer-Encoding: 7bit
1074 Content-Disposition: inline
1075
1076
1077
1078 ------=_Part_876302
1079 Content-Type: text/html; charset="UTF-8"
1080 Content-Transfer-Encoding: 8bit
1081 Content-Disposition: inline
1082
1083 <html><head>
1084 <title>eticket</title>
1085 </head>
1086 <body>
1087 Yes, the text/plain part really was empty.
1088 </body>
1089 </html>
1090
1091 ------=_Part_876302--
1092 EOF
1093
1094 run_prog mhfixmsg last -replacetextplain -noreplacetextplain -outfile "$actual"
1095 check "$expected" "$actual"
1096
1097
1098 # check removal of extraneous trailing semicolon from header parameter list
1099 cat >"$expected" <<EOF
1100 To: recipient@example.com
1101 Subject: test
1102 From: sender@example.com
1103 MIME-Version: 1.0
1104 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1105
1106 ------- =_aaaaaaaaaa0
1107 Content-Type: text/plain; charset="us-ascii"
1108
1109 test
1110
1111 ------- =_aaaaaaaaaa0
1112 Content-Type: text/plain; charset="us-ascii";
1113 name="DATE"
1114 Content-Description: check folded headers, with and without trailing semicolon
1115 Content-Disposition: attachment;
1116 filename="DATE"
1117
1118 14 April 2014
1119
1120 ------- =_aaaaaaaaaa0--
1121 EOF
1122
1123 cat >`mhpath new` <<EOF
1124 To: recipient@example.com
1125 Subject: test
1126 From: sender@example.com
1127 MIME-Version: 1.0
1128 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1129
1130 ------- =_aaaaaaaaaa0
1131 Content-Type: text/plain; charset="us-ascii";
1132
1133 test
1134
1135 ------- =_aaaaaaaaaa0
1136 Content-Type: text/plain; charset="us-ascii";
1137 name="DATE"
1138 Content-Description: check folded headers, with and without trailing semicolon
1139 Content-Disposition: attachment;
1140 filename="DATE";
1141
1142 14 April 2014
1143
1144 ------- =_aaaaaaaaaa0--
1145 EOF
1146 run_test 'mhfixmsg last -outfile '"$actual" ''
1147 check "$expected" "$actual"
1148
1149
1150 # check rmmproc
1151 cat >"$MH_TEST_DIR/Mail/rmmproc" <<'EOF'
1152 mv "$1" "$1.backup"
1153 EOF
1154 chmod a+x "${MH_TEST_DIR}/Mail/rmmproc"
1155 echo "rmmproc: ${MH_TEST_DIR}/Mail/rmmproc" >>"$MH"
1156 cp "${MH_TEST_DIR}/Mail/inbox/15" "${MH_TEST_DIR}/Mail/inbox/15.original"
1157
1158 run_test 'mhfixmsg 15' ''
1159 check "${MH_TEST_DIR}/Mail/inbox/15.backup" \
1160 "${MH_TEST_DIR}/Mail/inbox/15.original"
1161
1162
1163 # check -normmproc
1164 cp "${MH_TEST_DIR}/Mail/inbox/19" "${MH_TEST_DIR}/Mail/inbox/20"
1165
1166 run_test 'mhfixmsg 19 -normmproc'
1167 check "${MH_TEST_DIR}/Mail/inbox/20" \
1168 "${MH_TEST_DIR}/Mail/inbox/,19" 'keep first'
1169
1170
1171 # check -rmmproc
1172 run_test 'mhfixmsg 20 -rmmproc true'
1173 if test -f '${MH_TEST_DIR}/Mail/inbox/20.backup'; then
1174 echo check of mhfixmsg -rmmproc FAILED, should not have created backup file
1175 failed=`expr ${failed:-0} + 1`
1176 fi
1177
1178
1179 # check -fixtype
1180 cat >"$expected" <<EOF
1181 To: recipient@example.com
1182 From: sender@example.com
1183 Subject: mhfixmsg with incorrect Content-Type
1184 MIME-Version: 1.0
1185 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1186
1187 ------- =_aaaaaaaaaa0
1188 Content-Type: text/plain; name="plaintext.txt"
1189
1190 this is plain text
1191
1192 ------- =_aaaaaaaaaa0--
1193 EOF
1194
1195 cat >`mhpath new` <<EOF
1196 To: recipient@example.com
1197 From: sender@example.com
1198 Subject: mhfixmsg with incorrect Content-Type
1199 MIME-Version: 1.0
1200 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1201
1202 ------- =_aaaaaaaaaa0
1203 Content-Type: application/octet-stream; name="plaintext.txt"
1204
1205 this is plain text
1206
1207 ------- =_aaaaaaaaaa0--
1208 EOF
1209
1210 mhfixmsg -fixtype application/octet-stream last
1211 check "$expected" `mhpath last`
1212
1213
1214 # check default -decodetypes
1215 cat >$expected <<EOF
1216 To: recipient@example.com
1217 From: sender@example.com
1218 Subject: mhfixmsg decode test 3
1219 MIME-Version: 1.0
1220 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1221
1222 ------- =_aaaaaaaaaa0
1223 Content-Type: text/plain; charset="iso-8859-1"
1224 Content-Disposition: attachment; filename="test1.txt"
1225 Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
1226 Content-Transfer-Encoding: 8bit
1227
1228 This is the text/plain part.
1229
1230 ------- =_aaaaaaaaaa0
1231 Content-Type: text/plain; charset="iso-8859-1"; name="test2.txt"
1232 Content-Disposition: attachment; filename="test2.txt"
1233 Content-Transfer-Encoding: 8bit
1234
1235 <html>
1236 <head>
1237 This is the text/html part.
1238 </head>
1239 </body>
1240 </html>
1241
1242 ------- =_aaaaaaaaaa0--
1243 EOF
1244
1245 cat >`mhpath new` <<EOF
1246 To: recipient@example.com
1247 From: sender@example.com
1248 Subject: mhfixmsg decode test 3
1249 MIME-Version: 1.0
1250 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1251
1252 ------- =_aaaaaaaaaa0
1253 Content-Type: text/plain; charset="iso-8859-1"
1254 Content-Disposition: attachment; filename="test1.txt"
1255 Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
1256 Content-Transfer-Encoding: quoted-printable
1257
1258 This is the text/plain part.
1259
1260 ------- =_aaaaaaaaaa0
1261 Content-Type: text/plain; charset="iso-8859-1"; name="test2.txt"
1262 Content-Disposition: attachment; filename="test2.txt"
1263 Content-Transfer-Encoding: base64
1264
1265 PGh0bWw+CjxoZWFkPgogICAgVGhpcyBpcyB0aGUgdGV4dC9odG1sIHBhcnQuCjwvaGVhZD4KPC9i
1266 b2R5Pgo8L2h0bWw+Cg==
1267
1268 ------- =_aaaaaaaaaa0--
1269 EOF
1270 run_prog mhfixmsg last -outfile "$actual"
1271 check "$expected" "$actual"
1272
1273
1274 # check -decodetypes text/plain
1275 cat >$expected <<EOF
1276 To: recipient@example.com
1277 From: sender@example.com
1278 Subject: mhfixmsg decode test 4
1279 MIME-Version: 1.0
1280 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1281
1282 ------- =_aaaaaaaaaa0
1283 Content-Type: text/plain; charset="iso-8859-1"
1284 Content-Disposition: attachment; filename="test1.txt"
1285 Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
1286 Content-Transfer-Encoding: 8bit
1287
1288 This is the text/plain part.
1289
1290 ------- =_aaaaaaaaaa0
1291 Content-Type: multipart/alternative; boundary="----=_nmh-multipart2"
1292
1293 ------=_nmh-multipart2
1294 Content-Type: text/plain; charset="iso-8859-1"; name="test2.txt"
1295 Content-Transfer-Encoding: 8bit
1296
1297 This is the text/html part.
1298
1299 ------=_nmh-multipart2
1300 Content-Type: text/html; charset="iso-8859-1"; name="test2.txt"
1301 Content-Disposition: attachment; filename="test2.txt"
1302 Content-Transfer-Encoding: base64
1303
1304 PGh0bWw+DQo8aGVhZD4NCiAgICBUaGlzIGlzIHRoZSB0ZXh0L2h0bWwgcGFydC4NCjwvaGVhZD4N
1305 CjwvYm9keT4NCjwvaHRtbD4NCg==
1306
1307 ------=_nmh-multipart2--
1308
1309 ------- =_aaaaaaaaaa0--
1310 EOF
1311
1312 cat >`mhpath new` <<EOF
1313 To: recipient@example.com
1314 From: sender@example.com
1315 Subject: mhfixmsg decode test 4
1316 MIME-Version: 1.0
1317 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1318
1319 ------- =_aaaaaaaaaa0
1320 Content-Type: text/plain; charset="iso-8859-1"
1321 Content-Disposition: attachment; filename="test1.txt"
1322 Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
1323 Content-Transfer-Encoding: quoted-printable
1324
1325 This is the text/plain part.
1326
1327 ------- =_aaaaaaaaaa0
1328 Content-Type: text/html; charset="iso-8859-1"; name="test2.txt"
1329 Content-Disposition: attachment; filename="test2.txt"
1330 Content-Transfer-Encoding: base64
1331
1332 PGh0bWw+CjxoZWFkPgogICAgVGhpcyBpcyB0aGUgdGV4dC9odG1sIHBhcnQuCjwvaGVhZD4KPC9i
1333 b2R5Pgo8L2h0bWw+Cg==
1334
1335 ------- =_aaaaaaaaaa0--
1336 EOF
1337 run_prog mhfixmsg last -outfile "$actual" -decodetypes text/plain
1338 check "$expected" "$actual"
1339
1340
1341 # make sure there are no tmp files left over
1342 find "$MH_TEST_DIR/Mail" \( -name 'mhfix*' -o -name ',mhfix*' \) -print \
1343 >"$actual"
1344 cat >"$expected" <<EOF
1345 EOF
1346
1347 check "$expected" "$actual"
1348
1349
1350 exit $failed