2 ######################################################
6 ######################################################
10 if test -z "${MH_OBJ_DIR}"; then
11 srcdir
=`dirname $0`/..
/..
12 MH_OBJ_DIR
=`cd $srcdir && pwd`; export MH_OBJ_DIR
15 .
"${MH_OBJ_DIR}/test/common.sh"
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
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"
28 mhn_defaults
="$MH_INST_DIR${nmhetcdir}/mhn.defaults"
30 if grep mhfixmsg-format
-text
/html
"${mhn_defaults}" \
32 can_reformat_texthtml
=1
33 if grep 'mhfixmsg-format-text/html.*w3m' "${mhn_defaults}" \
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
43 echo "$0: skipping -reformat check because no text browser was found"
44 can_reformat_texthtml
=0
49 cat >"$expected" <<EOF
50 Usage: mhfixmsg [+folder] [msgs] [switches]
71 run_prog mhfixmsg
-help >"$actual" 2>&1
72 check
"$expected" "$actual"
76 case `mhfixmsg -version` in
78 *) printf '%s: mhfixmsg -version generated unexpected output\n' "$0" >&2
79 failed
=`expr ${failed:-0} + 1`;;
83 # check that non-MIME messages aren't modified
85 run_test
'mhfixmsg first -outfile '"$actual" ''
86 check
"`mhpath first`" "$actual" 'keep first'
89 # check that non-MIME messages with no bodies aren't modified
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
96 Subject: message with no body
99 run_test
'mhfixmsg last -outfile '"$actual" ''
100 check
"`mhpath last`" "$actual"
104 cat >"$MH_TEST_DIR"/Mail
/inbox
/11 <<EOF
107 Subject: =?ISO-8859-15?Q?Re=3A_H=E5lla_linuxsystem_uppdaterade?=
108 User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
110 Content-Type: MULTIPART/MIXED;
111 BOUNDARY="----=_NextPart_000_0000_00000000.00000000"
112 Content-Transfer-Encoding: QUOTED-PRINTABLE
114 This message is in MIME format. The first part should be readable
116 while the remaining parts are likely unreadable without MIME-aware
119 ------=_NextPart_000_0000_00000000.00000000
120 Content-Type: TEXT/PLAIN; CHARSET=ISO-8859-15
121 Content-Transfer-Encoding: 8BIT
123 Some text in swedish.
125 Varf=C3=B6r inte anv=C3=A4nda...
127 ------=_NextPart_000_0000_00000000.00000000--
129 And some text after the last part.
132 cp -p "$MH_TEST_DIR"/Mail
/inbox
/11 "$MH_TEST_DIR"/Mail
/inbox
/12
134 run_test
'mhfixmsg last -nofixcte' ''
135 check
"$MH_TEST_DIR"/Mail
/inbox
/11 "$MH_TEST_DIR"/Mail
/inbox
/12 'keep first'
138 # check -fixcte (enabled by default): fixup of erroneous C-T-E in multipart
140 cat >"$expected" <<EOF
143 Subject: =?ISO-8859-15?Q?Re=3A_H=E5lla_linuxsystem_uppdaterade?=
144 User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
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
151 This message is in MIME format. The first part should be readable
153 while the remaining parts are likely unreadable without MIME-aware
156 ------=_NextPart_000_0000_00000000.00000000
157 Content-Type: TEXT/PLAIN; CHARSET=ISO-8859-15
158 Content-Transfer-Encoding: 8BIT
160 Some text in swedish.
162 Varf=C3=B6r inte anv=C3=A4nda...
164 ------=_NextPart_000_0000_00000000.00000000--
166 And some text after the last part.
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'
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
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
192 # check -reformat (enabled by default): addition of text/plain part
193 # to solitary text/html part
195 prepare_space
>"$expected" <<EOF
197 From: sender@example.com
198 To: bonquiqui@example.com
200 Date: Sat, 26 Jan 2013 17:37:53 -0500
201 Content-Type: multipart/alternative; boundary="----=_nmh-multipart"
203 ------=_nmh-multipart
204 Content-Type: text/plain; charset="Windows-1252"
205 Content-Transfer-Encoding: 8bit
207 Need to go! Need ... to ... go!
209 ------=_nmh-multipart
210 Content-Type: text/html; charset="Windows-1252"
211 Content-Transfer-Encoding: 8bit
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>
221 <div>Need to go! Need ... to ... go!</div>
225 ------=_nmh-multipart--
228 cat >"$MH_TEST_DIR"/Mail
/inbox
/12 <<EOF
230 From: sender@example.com
231 To: bonquiqui@example.com
233 Date: Sat, 26 Jan 2013 17:37:53 -0500
234 Content-Type: text/html; charset="Windows-1252"
235 Content-Transfer-Encoding: quoted-printable
239 <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DWindows-1=
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>
247 <div>Need to go! Need ... to ... go!</div>
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\"" \
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"
267 # check implicit -file with absolute pathname
268 run_test
"mhfixmsg `mhpath last` -outfile /dev/null" ''
271 # check handling of boundary string that appears in message body
273 prepare_space
>"$expected" <<EOF
275 From: sender@example.com
276 To: bonquiqui@example.com
278 Date: Sat, 26 Jan 2013 17:37:53 -0500
279 Content-Type: multipart/alternative; boundary="----=_nmh-multipart-3"
281 ------=_nmh-multipart-3
282 Content-Type: text/plain; charset="Windows-1252"
283 Content-Transfer-Encoding: 8bit
285 ------=_nmh-multipart
286 ------=_nmh-multipart-1
287 ------=_nmh-multipart-2
289 ------=_nmh-multipart-3
290 Content-Type: text/html; charset="Windows-1252"
291 Content-Transfer-Encoding: 8bit
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>
300 ------=_nmh-multipart<br>
301 ------=_nmh-multipart-1<br>
302 ------=_nmh-multipart-2<br>
306 ------=_nmh-multipart-3--
309 cat >"$MH_TEST_DIR"/Mail
/inbox
/12 <<EOF
311 From: sender@example.com
312 To: bonquiqui@example.com
314 Date: Sat, 26 Jan 2013 17:37:53 -0500
315 Content-Type: text/html; charset="Windows-1252"
316 Content-Transfer-Encoding: quoted-printable
320 <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DWindows-1=
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>
327 ------=3D_nmh-multipart<br>
328 ------=3D_nmh-multipart-1<br>
329 ------=3D_nmh-multipart-2<br>
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\"" \
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"
350 prepare_space
>"$expected" <<EOF
352 From: sender@example.com
353 To: bonquiqui@example.com
355 Date: Sat, 26 Jan 2013 17:37:53 -0500
356 Content-Type: multipart/alternative; boundary="----=_nmh-multipart"
358 ------=_nmh-multipart
359 Content-Type: text/plain; charset="Windows-1252"
360 Content-Transfer-Encoding: 8bit
362 Need to go! Need ... to ... go!
364 ------=_nmh-multipart
365 Content-Type: text/html; charset="Windows-1252"
366 Content-Transfer-Encoding: quoted-printable
370 <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DWindows-=
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>
378 <div>Need to go! Need ... to ... go!</div>
382 ------=_nmh-multipart--
385 cat >"$MH_TEST_DIR"/Mail
/inbox
/12 <<EOF
387 From: sender@example.com
388 To: bonquiqui@example.com
390 Date: Sat, 26 Jan 2013 17:37:53 -0500
391 Content-Type: text/html; charset="Windows-1252"
392 Content-Transfer-Encoding: quoted-printable
396 <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DWindows-1=
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>
404 <div>Need to go! Need ... to ... go!</div>
409 if [ $can_reformat_texthtml -eq 1 ]; then
410 printf '%s\n' 'mhfixmsg: 12, insert text/plain part' >"$expected.err"
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"
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
428 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
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
435 This is a text/plain part.
437 ------- =_aaaaaaaaaa0--
440 cat >`mhpath new` <<EOF
441 To: recipient@example.com
442 From: sender@example.com
443 Subject: mhfixmsg decode test 1
445 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
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
452 VGhpcyBpcyBhIHRleHQvcGxhaW4gcGFydC4K
454 ------- =_aaaaaaaaaa0--
457 run_prog mhfixmsg last
-outfile "$actual"
458 check
"$expected" "$actual"
461 # check -decodetext with more complicated content structure
463 To: recipient@example.com
464 From: sender@example.com
465 Subject: mhfixmsg decode test 2
467 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
469 This is additional content before the first subpart of the multipart.
471 ------- =_aaaaaaaaaa0
472 Content-Type: multipart/related;
473 type="text/plain"; boundary="subpart__1.1"
476 Content-Type: text/plain; charset="iso-8859-1"
477 Content-Disposition: attachment; filename="test1.txt"
479 This is the first text/plain part, in a subpart.
483 This is additional content after the last subpart of the multipart.
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
491 This is the second text/plain part.
493 ------- =_aaaaaaaaaa0
494 Content-Type: text/plain; charset="iso-8859-1"
495 Content-Disposition: attachment; filename="test3.txt"
497 This is the third text/plain part.
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
504 This is the fourth text/plain part.
506 ------- =_aaaaaaaaaa0--
508 This is additional content after the last subpart of the multipart.
511 cat >`mhpath new` <<EOF
512 To: recipient@example.com
513 From: sender@example.com
514 Subject: mhfixmsg decode test 2
516 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
518 This is additional content before the first subpart of the multipart.
520 ------- =_aaaaaaaaaa0
521 Content-Type: multipart/related;
522 type="text/plain"; boundary="subpart__1.1"
525 Content-Type: text/plain; charset="iso-8859-1"
526 Content-Disposition: attachment; filename="test1.txt"
528 This is the first text/plain part, in a subpart.
532 This is additional content after the last subpart of the multipart.
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
540 This is the second text/plain part.
542 ------- =_aaaaaaaaaa0
543 Content-Type: text/plain; charset="iso-8859-1"
544 Content-Disposition: attachment; filename="test3.txt"
546 This is the third text/plain part.
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
553 VGhpcyBpcyB0aGUgZm91cnRoIHRleHQvcGxhaW4gcGFydC4K
555 ------- =_aaaaaaaaaa0--
557 This is additional content after the last subpart of the multipart.
559 run_prog mhfixmsg last
-outfile "$actual"
560 check
"$expected" "$actual"
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
571 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
573 ------- =_aaaaaaaaaa0
574 Content-Type: text/plain; charset="iso-8859-1"; name="nul+square.txt"
575 Content-Transfer-Encoding: base64
579 ------- =_aaaaaaaaaa0--
582 cp -p `mhpath last` "$expected"
583 run_prog mhfixmsg last
584 check
`mhpath last` "$expected" 'keep first'
587 # check for successful decode of a different part with attempted -decodetext
589 #### Generated the encoded text below with:
590 #### $ printf '\x0\xbd\xb2=\xbc\n' | base64
592 To: recipient@example.com
593 From: sender@example.com
594 Subject: mhfixmsg successful decode of text/plain with failed binary decode
596 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
598 ------- =_aaaaaaaaaa0
599 Content-Type: text/plain; charset="iso-8859-1"
600 Content-Transfer-Encoding: 8bit
602 This is a text plain part
604 ------- =_aaaaaaaaaa0
605 Content-Type: text/html; charset="ascii"
606 Content-Transfer-Encoding: base64
607 Content-Disposition: inline
609 PGh0bWw+PGhlYWQ+PHRpdGxlPmxvbmcgbGluZTwvdGl0bGU+PC9oZWFkPjxib2R5PlRoaXMgbGlu
610 ZSBpcyBncmVhdGVyIHRoYW4gOTk4IGNoYXJhY3RlcnMgaW4gbGVuZ3RoLCBzbyB0aGlzIHBhcnQg
611 c2hvdWxkIG5vdCBiZSBkZWNvZGVkLiAgVGhpcyBsaW5lIGlzIGdyZWF0ZXIgdGhhbiA5OTggY2hh
612 cmFjdGVycyBpbiBsZW5ndGgsIHNvIHRoaXMgcGFydCBzaG91bGQgbm90IGJlIGRlY29kZWQuICBU
613 aGlzIGxpbmUgaXMgZ3JlYXRlciB0aGFuIDk5OCBjaGFyYWN0ZXJzIGluIGxlbmd0aCwgc28gdGhp
614 cyBwYXJ0IHNob3VsZCBub3QgYmUgZGVjb2RlZC4gIFRoaXMgbGluZSBpcyBncmVhdGVyIHRoYW4g
615 OTk4IGNoYXJhY3RlcnMgaW4gbGVuZ3RoLCBzbyB0aGlzIHBhcnQgc2hvdWxkIG5vdCBiZSBkZWNv
616 ZGVkLiAgVGhpcyBsaW5lIGlzIGdyZWF0ZXIgdGhhbiA5OTggY2hhcmFjdGVycyBpbiBsZW5ndGgs
617 IHNvIHRoaXMgcGFydCBzaG91bGQgbm90IGJlIGRlY29kZWQuICBUaGlzIGxpbmUgaXMgZ3JlYXRl
618 ciB0aGFuIDk5OCBjaGFyYWN0ZXJzIGluIGxlbmd0aCwgc28gdGhpcyBwYXJ0IHNob3VsZCBub3Qg
619 YmUgZGVjb2RlZC4gIFRoaXMgbGluZSBpcyBncmVhdGVyIHRoYW4gOTk4IGNoYXJhY3RlcnMgaW4g
620 bGVuZ3RoLCBzbyB0aGlzIHBhcnQgc2hvdWxkIG5vdCBiZSBkZWNvZGVkLiAgVGhpcyBsaW5lIGlz
621 IGdyZWF0ZXIgdGhhbiA5OTggY2hhcmFjdGVycyBpbiBsZW5ndGgsIHNvIHRoaXMgcGFydCBzaG91
622 bGQgbm90IGJlIGRlY29kZWQuICBUaGlzIGxpbmUgaXMgZ3JlYXRlciB0aGFuIDk5OCBjaGFyYWN0
623 ZXJzIGluIGxlbmd0aCwgc28gdGhpcyBwYXJ0IHNob3VsZCBub3QgYmUgZGVjb2RlZC4gIFRoaXMg
624 bGluZSBpcyBncmVhdGVyIHRoYW4gOTk4IGNoYXJhY3RlcnMgaW4gbGVuZ3RoLCBzbyB0aGlzIHBh
625 cnQgc2hvdWxkIG5vdCBiZSBkZWNvZGVkLiAgVGhpcyBsaW5lIGlzIGdyZWF0ZXIgdGhhbiA5OTgg
626 Y2hhcmFjdGVycyBpbiBsZW5ndGgsIHNvIHRoaXMgcGFydCBzaG91bGQgbm90IGJlIGRlY29kZWQu
627 ICA8L2JvZHk+PC9odG1sPg==
629 ------- =_aaaaaaaaaa0--
632 cat >`mhpath new` <<EOF
633 To: recipient@example.com
634 From: sender@example.com
635 Subject: mhfixmsg successful decode of text/plain with failed binary decode
637 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
639 ------- =_aaaaaaaaaa0
640 Content-Type: text/plain; charset="iso-8859-1"
641 Content-Transfer-Encoding: base64
643 VGhpcyBpcyBhIHRleHQgcGxhaW4gcGFydAo=
645 ------- =_aaaaaaaaaa0
646 Content-Type: text/html; charset="ascii"
647 Content-Transfer-Encoding: base64
648 Content-Disposition: inline
650 PGh0bWw+PGhlYWQ+PHRpdGxlPmxvbmcgbGluZTwvdGl0bGU+PC9oZWFkPjxib2R5PlRoaXMgbGlu
651 ZSBpcyBncmVhdGVyIHRoYW4gOTk4IGNoYXJhY3RlcnMgaW4gbGVuZ3RoLCBzbyB0aGlzIHBhcnQg
652 c2hvdWxkIG5vdCBiZSBkZWNvZGVkLiAgVGhpcyBsaW5lIGlzIGdyZWF0ZXIgdGhhbiA5OTggY2hh
653 cmFjdGVycyBpbiBsZW5ndGgsIHNvIHRoaXMgcGFydCBzaG91bGQgbm90IGJlIGRlY29kZWQuICBU
654 aGlzIGxpbmUgaXMgZ3JlYXRlciB0aGFuIDk5OCBjaGFyYWN0ZXJzIGluIGxlbmd0aCwgc28gdGhp
655 cyBwYXJ0IHNob3VsZCBub3QgYmUgZGVjb2RlZC4gIFRoaXMgbGluZSBpcyBncmVhdGVyIHRoYW4g
656 OTk4IGNoYXJhY3RlcnMgaW4gbGVuZ3RoLCBzbyB0aGlzIHBhcnQgc2hvdWxkIG5vdCBiZSBkZWNv
657 ZGVkLiAgVGhpcyBsaW5lIGlzIGdyZWF0ZXIgdGhhbiA5OTggY2hhcmFjdGVycyBpbiBsZW5ndGgs
658 IHNvIHRoaXMgcGFydCBzaG91bGQgbm90IGJlIGRlY29kZWQuICBUaGlzIGxpbmUgaXMgZ3JlYXRl
659 ciB0aGFuIDk5OCBjaGFyYWN0ZXJzIGluIGxlbmd0aCwgc28gdGhpcyBwYXJ0IHNob3VsZCBub3Qg
660 YmUgZGVjb2RlZC4gIFRoaXMgbGluZSBpcyBncmVhdGVyIHRoYW4gOTk4IGNoYXJhY3RlcnMgaW4g
661 bGVuZ3RoLCBzbyB0aGlzIHBhcnQgc2hvdWxkIG5vdCBiZSBkZWNvZGVkLiAgVGhpcyBsaW5lIGlz
662 IGdyZWF0ZXIgdGhhbiA5OTggY2hhcmFjdGVycyBpbiBsZW5ndGgsIHNvIHRoaXMgcGFydCBzaG91
663 bGQgbm90IGJlIGRlY29kZWQuICBUaGlzIGxpbmUgaXMgZ3JlYXRlciB0aGFuIDk5OCBjaGFyYWN0
664 ZXJzIGluIGxlbmd0aCwgc28gdGhpcyBwYXJ0IHNob3VsZCBub3QgYmUgZGVjb2RlZC4gIFRoaXMg
665 bGluZSBpcyBncmVhdGVyIHRoYW4gOTk4IGNoYXJhY3RlcnMgaW4gbGVuZ3RoLCBzbyB0aGlzIHBh
666 cnQgc2hvdWxkIG5vdCBiZSBkZWNvZGVkLiAgVGhpcyBsaW5lIGlzIGdyZWF0ZXIgdGhhbiA5OTgg
667 Y2hhcmFjdGVycyBpbiBsZW5ndGgsIHNvIHRoaXMgcGFydCBzaG91bGQgbm90IGJlIGRlY29kZWQu
668 ICA8L2JvZHk+PC9odG1sPg==
670 ------- =_aaaaaaaaaa0--
673 run_prog mhfixmsg
-noreformat last
674 check
`mhpath last` "$expected"
677 # check -decodetext of binary text
678 printf "%s\x0d\xbd\xb2=\xbc%s" "To: recipient@example.com
679 From: sender@example.com
680 Subject: mhfixmsg binary decode test
682 Content-Type: multipart/mixed; boundary=\"----- =_aaaaaaaaaa0\"
684 ------- =_aaaaaaaaaa0
685 Content-Type: text/plain; charset=\"iso-8859-1\"; name=\"nul+square.txt\"
686 Content-Transfer-Encoding: binary
690 ------- =_aaaaaaaaaa0--
692 ## output_content() in mhoutsbr.c can't handle binary content.
693 ## mhfixmsg last -decodetext binary -outfile "$actual"
694 ## check "$expected" "$actual"
699 # check that -reformat succeeds when decode of binary text fails
700 prepare_space
>"$expected" <<'EOF'
702 Date: Thu, 11 Apr 2013 02:47:08 -0700
704 From: <sender@example.com>
705 Subject: body requires binary encoding
706 Content-Type: multipart/alternative; boundary="----=_nmh-multipart"
708 ------=_nmh-multipart
709 Content-Type: text/plain; charset="ISO-8859-1"
710 Content-Transfer-Encoding: 8bit
715 Vehicle License Fee $1.84
718 ------=_nmh-multipart
719 Content-Type: text/html; charset="ISO-8859-1"
720 Content-Transfer-Encoding: quoted-printable
725 cat >`mhpath new` <<'EOF'
727 Content-Type: text/html; charset="ISO-8859-1"
728 Content-Transfer-Encoding: quoted-printable
729 Date: Thu, 11 Apr 2013 02:47:08 -0700
731 From: <sender@example.com>
732 Subject: body requires binary encoding
735 <table width=3D"325" border=3D"0" cellspacing=3D"0" cellpadding=3D"0">
736 <tr><td><font face=3D"Arial, Helvetica, sans-serif" color=3D"#333333" size=
737 =3D"2"><strong>Mile</strong></font></td><td height=3D"3"> </td><td ali=
738 gn=3D"right"><font face=3D"Arial, Helvetica, sans-serif" color=3D"#333333" =
739 size=3D"2">$0.00</font></td></tr><tr><td><font face=3D"Arial, Helvetica, sa=
740 ns-serif" color=3D"#333333" size=3D"2"><strong>Time</strong></font></td><td=
741 height=3D"3"> </td><td align=3D"right"><font face=3D"Arial, Helvetica=
742 , sans-serif" color=3D"#333333" size=3D"2">$78.71</font></td></tr><tr><td><=
743 font face=3D"Arial, Helvetica, sans-serif" color=3D"#333333" size=3D"2"><st=
744 rong>State Tax</strong></font></td><td height=3D"3"> </td><td align=3D=
745 "right"><font face=3D"Arial, Helvetica, sans-serif" color=3D"#333333" size=
746 =3D"2">$5.90</font></td></tr><tr><td><font face=3D"Arial, Helvetica, sans-s=
747 erif" color=3D"#333333" size=3D"2"><strong>Vehicle License Fee</strong></fo=
748 nt></td><td height=3D"3"> </td><td align=3D"right"><font face=3D"Arial=
749 , Helvetica, sans-serif" color=3D"#333333" size=3D"2">$1.84</font></td></tr=
750 ><tr><td><font face=3D"Arial, Helvetica, sans-serif" color=3D"#333333" size=
751 =3D"2"><strong>State Txn Tax</strong></font></td><td height=3D"3"> </t=
752 d><td align=3D"right"><font face=3D"Arial, Helvetica, sans-serif" color=3D"=
753 #333333" size=3D"2">$6.00</font></td></tr>
759 if [ $can_reformat_texthtml -eq 1 ]; then
760 #### lynx inserts multiple blank lines, so squeeze them.
761 #### Truncate to avoid comparing the html portion because it can
762 #### get reformatted.
763 run_prog mhfixmsg last
-outfile - | squeeze_lines
| head -22 >"$actual"
764 check
"$expected" "$actual" 'ignore space'
766 cp -p "$MH_TEST_DIR/Mail/inbox/15" "$MH_TEST_DIR/Mail/inbox/15.backup"
772 # Also checks preservation of attributes after one (charset) that is
774 cat >"$expected" <<EOF
775 To: recipient@example.com
776 From: sender@example.com
777 Subject: mhfixmsg textcharset test
779 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
781 ------- =_aaaaaaaaaa0
782 Content-Type: text/plain; charset="utf-8"; name="square.txt"
783 Content-Disposition: attachment; filename="square.txt"
784 Content-Transfer-Encoding: 8bit
788 ------- =_aaaaaaaaaa0--
791 #### Generated the encoded text below with:
792 #### $ printf '\xbd\xb2=\xbc\n' | base64
793 cat >`mhpath new` <<EOF
794 To: recipient@example.com
795 From: sender@example.com
796 Subject: mhfixmsg textcharset test
798 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
800 ------- =_aaaaaaaaaa0
801 Content-Type: text/plain; charset="iso-8859-1"; name="square.txt"
802 Content-Disposition: attachment; filename="square.txt"
803 Content-Transfer-Encoding: base64
807 ------- =_aaaaaaaaaa0--
810 if test "$ICONV_ENABLED" -eq 1; then
811 run_prog mhfixmsg last
-textcharset utf-8
-outfile "$actual" 2>&1
812 check
"$expected" "$actual"
814 echo "$0: skipping -textcharset check because nmh was built without iconv"
819 # check -nofixboundary
820 cat >"$expected" <<EOF
823 cat >`mhpath new` <<EOF
824 Date: Fri, 13 May 2011 08:21:12 -0500
825 Content-Type: multipart/alternative;
826 boundary="----=_NextPart_000_1781A17_01CC1147.81E9467A"
827 Content-Transfer-Encoding: 8bit
829 From: <sender@example.com>
830 To: <recipient@example.com>
831 Subject: mhfixmsg bad boundary test
833 This is a multi-part message in MIME format.
835 ------=_NextPart_000_1781A1A_01CC1147.81EBA8D4
836 Content-Type: text/plain
838 The boundaries of this part don't match the header boundary.
840 ------=_NextPart_000_1781A1A_01CC1147.81EBA8D4--
843 cp -p `mhpath last` `mhpath new`
845 run_test
'mhfixmsg last -nofixboundary' ''
846 check
"$MH_TEST_DIR"/Mail
/inbox
/17 "$MH_TEST_DIR"/Mail
/inbox
/18 'keep first'
849 # check that message is not output when fed through stdin
850 run_prog mhfixmsg
-file - -verbose <`mhpath last` >"$actual" 2>"$actual.err"
851 check
"$expected" "$actual"
852 if grep "mhfixmsg: $MH_TEST_DIR/Mail/.*, fix multipart boundary" \
853 "$actual.err" >/dev
/null
; then
856 echo "$0: test failed, output is in $actual.err."
857 failed
=`expr ${failed:-0} + 1`
861 # check fixup of erroneous boundary in multipart (-fixboundary,
862 # enabled by default)
864 cat >"$expected" <<EOF
865 Date: Fri, 13 May 2011 08:21:12 -0500
866 Content-Type: multipart/alternative;
867 boundary="----=_NextPart_000_1781A1A_01CC1147.81EBA8D4"
868 Content-Transfer-Encoding: 8bit
870 From: <sender@example.com>
871 To: <recipient@example.com>
872 Subject: mhfixmsg bad boundary test
874 This is a multi-part message in MIME format.
876 ------=_NextPart_000_1781A1A_01CC1147.81EBA8D4
877 Content-Type: text/plain
879 The boundaries of this part don't match the header boundary.
881 ------=_NextPart_000_1781A1A_01CC1147.81EBA8D4--
884 run_test
'mhfixmsg last -outfile '"$actual"' -verbose' \
885 "mhfixmsg: 17, fix multipart boundary"
886 check
"$expected" "$actual"
889 # check that text/plain part is not added to text/html in multipart/related
890 # when it shouldn't be
891 cat >`mhpath new` <<EOF
893 Date: Tue, 26 Feb 2013 18:07:20 -0600
894 Subject: multipart/related, not /alternative
895 Content-Type: multipart/related;
896 type="text/html"; boundary="----=_Part_90310_101292502.1"
898 ------=_Part_90310_101292502.1
899 Content-Type: text/html; charset="us-ascii"
900 Content-Transfer-Encoding: 7bit
903 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
904 <title>HTML Content</title>
907 This is the real content.
911 ------=_Part_90310_101292502.1
912 Content-Type: text/plain; charset="us-ascii"
913 Content-Transfer-Encoding: 7bit
915 Your email client does not support HTML messages
917 ------=_Part_90310_101292502.1--
920 cp -p `mhpath last` "$expected"
922 if [ $can_reformat_texthtml -eq 1 ]; then
923 #### lynx inserts multiple blank lines, so squeeze them.
924 run_prog mhfixmsg last
-outfile - | squeeze_lines
>"$actual"
925 check
"$expected" "$actual" 'ignore space'
931 # check that text/plain part is added to text/html in multipart/related
933 cat >"$expected" <<EOF
935 Date: Tue, 26 Feb 2013 18:07:20 -0600
936 Subject: multipart/related, not /alternative
937 Content-Type: multipart/alternative; boundary="----=_Part_90310_101292502.1"
939 ------=_Part_90310_101292502.1
940 Content-Type: text/plain; charset="us-ascii"
941 Content-Transfer-Encoding: 7bit
943 This is the real content.
945 ------=_Part_90310_101292502.1
946 Content-Type: text/html; charset="us-ascii"
947 Content-Transfer-Encoding: 7bit
950 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
951 <title>HTML Content</title>
954 This is the real content.
958 ------=_Part_90310_101292502.1--
961 cat >`mhpath new` <<EOF
963 Date: Tue, 26 Feb 2013 18:07:20 -0600
964 Subject: multipart/related, not /alternative
965 Content-Type: multipart/related;
966 type="text/html"; boundary="----=_Part_90310_101292502.1"
968 ------=_Part_90310_101292502.1
969 Content-Type: text/html; charset="us-ascii"
970 Content-Transfer-Encoding: 7bit
973 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
974 <title>HTML Content</title>
977 This is the real content.
981 ------=_Part_90310_101292502.1--
984 if [ $can_reformat_texthtml -eq 1 ]; then
985 #### lynx inserts multiple blank lines, so squeeze them.
986 run_prog mhfixmsg last
-outfile - | squeeze_lines
>"$actual"
987 check
"$expected" "$actual" 'ignore space'
993 # check handling of rfc822 message type
994 cat >"$expected" <<EOF
995 From: Test <test@example.com>
996 To: Some User <user@example.com>
997 Date: Fri, 29 Sep 2006 00:00:00
998 Message-Id: @test.nmh
999 Subject: message with message/rfc822 attachment
1001 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1003 and some garbage before the attachment
1005 ------- =_aaaaaaaaaa0
1006 Content-Type: message/rfc822; name="1552"; charset="us-ascii"
1007 Content-Description: 1552
1008 Content-Disposition: attachment; filename="1552"
1010 From: Test <test@example.com>
1011 To: <another_user@example.com>
1012 Date: Thu, 28 Sep 2006 00:00:00
1013 Message-Id: @test.nmh
1014 Subject: message/rfc822 attachment
1016 This is an RFC-822 message.
1018 ------- =_aaaaaaaaaa0--
1020 and some garbage at the end
1023 cat >`mhpath new` <<EOF
1024 From: Test <test@example.com>
1025 To: Some User <user@example.com>
1026 Date: Fri, 29 Sep 2006 00:00:00
1027 Message-Id: @test.nmh
1028 Subject: message with message/rfc822 attachment
1030 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaa0"
1032 and some garbage before the attachment
1034 ------- =_aaaaaaaaaa0
1035 Content-Type: message/rfc822; name="1552"; charset="us-ascii"
1036 Content-Description: 1552
1037 Content-Disposition: attachment; filename="1552"
1039 From: Test <test@example.com>
1040 To: <another_user@example.com>
1041 Date: Thu, 28 Sep 2006 00:00:00
1042 Message-Id: @test.nmh
1043 Subject: message/rfc822 attachment
1045 This is an RFC-822 message.
1047 ------- =_aaaaaaaaaa0--
1049 and some garbage at the end
1052 run_test
'mhfixmsg last -outfile '"$actual" ''
1053 check
"$expected" "$actual"
1056 # check stripping of CRs from ASCII text context
1057 cat >"$expected" <<EOF
1059 From: sender@example.com
1060 To: recipient@example.com
1061 Subject: message with CR's
1062 Date: Mon, 29 Apr 2013 11:51:45 -0400
1064 There are two CR-LF pairs at the end of this sentence.
1068 cat >`mhpath new` <<'EOF'
1070 From: sender@example.com
1071 To: recipient@example.com
1072 Subject: message with CR's
1073 Date: Mon, 29 Apr 2013 11:51:45 -0400
1075 There are two CR-LF pairs at the end of this sentence.
1079 run_prog mhfixmsg last
-outfile "$actual"
1080 check
"$expected" "$actual"
1083 # check -replacetextplain
1084 prepare_space
>"$expected" <<EOF
1085 To: recipient@example.com
1086 From: sender@example.com
1087 Subject: mhfixmsg replacement of bad text/plain part test
1089 Content-Type: multipart/alternative; boundary="----=_Part_876302"
1092 Content-Type: text/plain; charset="UTF-8"
1093 Content-Transfer-Encoding: 8bit
1095 Yes, the text/plain part really was empty.
1098 Content-Type: text/html; charset="UTF-8"
1099 Content-Transfer-Encoding: 8bit
1100 Content-Disposition: inline
1103 <title>eticket</title>
1106 Yes, the text/plain part really was empty.
1110 ------=_Part_876302--
1113 cat >`mhpath new` <<'EOF'
1114 To: recipient@example.com
1115 From: sender@example.com
1116 Subject: mhfixmsg replacement of bad text/plain part test
1118 Content-Type: multipart/alternative; boundary="----=_Part_876302"
1121 Content-Type: text/plain; charset="iso-8859-15"
1122 Content-Transfer-Encoding: 7bit
1123 Content-Disposition: inline
1128 Content-Type: text/html; charset="UTF-8"
1129 Content-Transfer-Encoding: 8bit
1130 Content-Disposition: inline
1133 <title>eticket</title>
1136 Yes, the text/plain part really was empty.
1140 ------=_Part_876302--
1143 if [ $can_reformat_texthtml -eq 1 ]; then
1144 #### lynx inserts multiple blank lines, so squeeze them.
1145 run_prog mhfixmsg last
-replacetextplain -outfile - | \
1146 squeeze_lines
> "$actual"
1147 check
"$expected" "$actual" 'ignore space'
1153 # check -noreplacetextplain
1154 cat >"$expected" <<EOF
1155 To: recipient@example.com
1156 From: sender@example.com
1157 Subject: mhfixmsg replacement of bad text/plain part test
1159 Content-Type: multipart/alternative; boundary="----=_Part_876302"
1162 Content-Type: text/plain; charset="iso-8859-15"
1163 Content-Transfer-Encoding: 7bit
1164 Content-Disposition: inline
1169 Content-Type: text/html; charset="UTF-8"
1170 Content-Transfer-Encoding: 8bit
1171 Content-Disposition: inline
1174 <title>eticket</title>
1177 Yes, the text/plain part really was empty.
1181 ------=_Part_876302--
1184 run_prog mhfixmsg last
-replacetextplain -noreplacetextplain -outfile "$actual"
1185 check
"$expected" "$actual"
1188 # check removal of extraneous trailing semicolon from header parameter list
1189 cat >"$expected" <<EOF
1190 To: recipient@example.com
1192 From: sender@example.com
1194 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1196 ------- =_aaaaaaaaaa0
1197 Content-Type: text/plain; charset="us-ascii"
1201 ------- =_aaaaaaaaaa0
1202 Content-Type: text/plain; charset="us-ascii";
1204 Content-Description: check folded headers, with and without trailing semicolon
1205 Content-Disposition: attachment;
1210 ------- =_aaaaaaaaaa0--
1213 cat >`mhpath new` <<EOF
1214 To: recipient@example.com
1216 From: sender@example.com
1218 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1220 ------- =_aaaaaaaaaa0
1221 Content-Type: text/plain; charset="us-ascii";
1225 ------- =_aaaaaaaaaa0
1226 Content-Type: text/plain; charset="us-ascii";
1228 Content-Description: check folded headers, with and without trailing semicolon
1229 Content-Disposition: attachment;
1234 ------- =_aaaaaaaaaa0--
1236 run_test
'mhfixmsg last -outfile '"$actual" ''
1237 check
"$expected" "$actual"
1241 cat >"$MH_TEST_DIR/Mail/rmmproc" <<'EOF'
1244 chmod a
+x
"${MH_TEST_DIR}/Mail/rmmproc"
1245 echo "rmmproc: ${MH_TEST_DIR}/Mail/rmmproc" >>"$MH"
1246 cp "${MH_TEST_DIR}/Mail/inbox/15" "${MH_TEST_DIR}/Mail/inbox/15.original"
1248 run_test
'mhfixmsg 15' ''
1249 check
"${MH_TEST_DIR}/Mail/inbox/15.backup" \
1250 "${MH_TEST_DIR}/Mail/inbox/15.original"
1254 cp "${MH_TEST_DIR}/Mail/inbox/19" "${MH_TEST_DIR}/Mail/inbox/20"
1256 run_test
'mhfixmsg 19 -normmproc'
1257 check
"${MH_TEST_DIR}/Mail/inbox/20" \
1258 "${MH_TEST_DIR}/Mail/inbox/,19" 'keep first'
1262 run_test
'mhfixmsg 20 -rmmproc true'
1263 if test -f '${MH_TEST_DIR}/Mail/inbox/20.backup'; then
1264 echo check of mhfixmsg
-rmmproc FAILED
, should not have created backup
file
1265 failed
=`expr ${failed:-0} + 1`
1270 cat >"$expected" <<EOF
1271 To: recipient@example.com
1272 From: sender@example.com
1273 Subject: mhfixmsg with incorrect Content-Type
1275 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1277 ------- =_aaaaaaaaaa0
1278 Content-Type: text/plain; name="plaintext.txt"
1282 ------- =_aaaaaaaaaa0--
1285 cat >`mhpath new` <<EOF
1286 To: recipient@example.com
1287 From: sender@example.com
1288 Subject: mhfixmsg with incorrect Content-Type
1290 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1292 ------- =_aaaaaaaaaa0
1293 Content-Type: application/octet-stream; name="plaintext.txt"
1297 ------- =_aaaaaaaaaa0--
1300 mhfixmsg
-fixtype application
/octet-stream last
1301 check
"$expected" `mhpath last`
1304 # check default -decodetypes
1305 cat >$expected <<EOF
1306 To: recipient@example.com
1307 From: sender@example.com
1308 Subject: mhfixmsg decode test 3
1310 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1312 ------- =_aaaaaaaaaa0
1313 Content-Type: text/plain; charset="iso-8859-1"
1314 Content-Disposition: attachment; filename="test1.txt"
1315 Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
1316 Content-Transfer-Encoding: 8bit
1318 This is the text/plain part.
1320 ------- =_aaaaaaaaaa0
1321 Content-Type: text/plain; charset="iso-8859-1"; name="test2.txt"
1322 Content-Disposition: attachment; filename="test2.txt"
1323 Content-Transfer-Encoding: 8bit
1327 This is the text/html part.
1332 ------- =_aaaaaaaaaa0--
1335 cat >`mhpath new` <<EOF
1336 To: recipient@example.com
1337 From: sender@example.com
1338 Subject: mhfixmsg decode test 3
1340 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1342 ------- =_aaaaaaaaaa0
1343 Content-Type: text/plain; charset="iso-8859-1"
1344 Content-Disposition: attachment; filename="test1.txt"
1345 Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
1346 Content-Transfer-Encoding: quoted-printable
1348 This is the text/plain part.
1350 ------- =_aaaaaaaaaa0
1351 Content-Type: text/plain; charset="iso-8859-1"; name="test2.txt"
1352 Content-Disposition: attachment; filename="test2.txt"
1353 Content-Transfer-Encoding: base64
1355 PGh0bWw+CjxoZWFkPgogICAgVGhpcyBpcyB0aGUgdGV4dC9odG1sIHBhcnQuCjwvaGVhZD4KPC9i
1356 b2R5Pgo8L2h0bWw+Cg==
1358 ------- =_aaaaaaaaaa0--
1360 run_prog mhfixmsg last
-outfile "$actual"
1361 check
"$expected" "$actual"
1364 # check -decodetypes text/plain
1365 cat >$expected <<EOF
1366 To: recipient@example.com
1367 From: sender@example.com
1368 Subject: mhfixmsg decode test 4
1370 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1372 ------- =_aaaaaaaaaa0
1373 Content-Type: text/plain; charset="iso-8859-1"
1374 Content-Disposition: attachment; filename="test1.txt"
1375 Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
1376 Content-Transfer-Encoding: 8bit
1378 This is the text/plain part.
1380 ------- =_aaaaaaaaaa0
1381 Content-Type: multipart/alternative; boundary="----=_nmh-multipart2"
1383 ------=_nmh-multipart2
1384 Content-Type: text/plain; charset="iso-8859-1"; name="test2.txt"
1385 Content-Transfer-Encoding: 8bit
1387 This is the text/html part.
1389 ------=_nmh-multipart2
1390 Content-Type: text/html; charset="iso-8859-1"; name="test2.txt"
1391 Content-Disposition: attachment; filename="test2.txt"
1392 Content-Transfer-Encoding: base64
1394 PGh0bWw+DQo8aGVhZD4NCiAgICBUaGlzIGlzIHRoZSB0ZXh0L2h0bWwgcGFydC4NCjwvaGVhZD4N
1395 CjwvYm9keT4NCjwvaHRtbD4NCg==
1397 ------=_nmh-multipart2--
1399 ------- =_aaaaaaaaaa0--
1402 cat >`mhpath new` <<EOF
1403 To: recipient@example.com
1404 From: sender@example.com
1405 Subject: mhfixmsg decode test 4
1407 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1409 ------- =_aaaaaaaaaa0
1410 Content-Type: text/plain; charset="iso-8859-1"
1411 Content-Disposition: attachment; filename="test1.txt"
1412 Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
1413 Content-Transfer-Encoding: quoted-printable
1415 This is the text/plain part.
1417 ------- =_aaaaaaaaaa0
1418 Content-Type: text/html; charset="iso-8859-1"; name="test2.txt"
1419 Content-Disposition: attachment; filename="test2.txt"
1420 Content-Transfer-Encoding: base64
1422 PGh0bWw+CjxoZWFkPgogICAgVGhpcyBpcyB0aGUgdGV4dC9odG1sIHBhcnQuCjwvaGVhZD4KPC9i
1423 b2R5Pgo8L2h0bWw+Cg==
1425 ------- =_aaaaaaaaaa0--
1427 run_prog mhfixmsg last
-outfile "$actual" -decodetypes text
/plain
1428 check
"$expected" "$actual"
1431 # make sure there are no tmp files left over
1432 find "$MH_TEST_DIR/Mail" \
( -name 'mhfix*' -o -name ',mhfix*' \
) -print \
1434 cat >"$expected" <<EOF
1437 check
"$expected" "$actual"