check "$expected" "$actual"
+# check that message is not modified when -fixboundary fails
+cat >`mhpath new` <<EOF
+Date: Fri, 13 May 2011 08:21:12 -0500
+Content-Type: multipart/alternative;
+ boundary="----=_ NextPart_000_1781A17_01CC1147.81E9467A"
+Content-Transfer-Encoding: 8bit
+MIME-Version: 1.0
+From: <sender@example.com>
+To: <recipient@example.com>
+Subject: mhfixmsg bad boundary test
+
+This is a multi-part message in MIME format.
+
+------=_ NextPart_000_1781A1A_01CC1147.81EBA8D4
+Content-Type: text/plain
+
+The boundary below doesn't match the header boundary.
+
+------=_
+NextPart_000_1781A1A_01CC1147.81EBA8D4--
+EOF
+
+cp -p `mhpath last` "$expected"
+run_test "mhfixmsg last -outfile $actual" ''
+check "$expected" "$actual"
+
+
# check that text/plain part is not added to text/html in multipart/related
# when it shouldn't be
cat >`mhpath new` <<EOF
# check -normmproc
-cp "${MH_TEST_DIR}/Mail/inbox/19" "${MH_TEST_DIR}/Mail/inbox/20"
+cp "${MH_TEST_DIR}/Mail/inbox/20" "${MH_TEST_DIR}/Mail/inbox/21"
-run_test 'mhfixmsg 19 -normmproc'
-check "${MH_TEST_DIR}/Mail/inbox/20" \
- "${MH_TEST_DIR}/Mail/inbox/,19" 'keep first'
+run_test 'mhfixmsg 20 -normmproc'
+check "${MH_TEST_DIR}/Mail/inbox/21" \
+ "${MH_TEST_DIR}/Mail/inbox/,20" 'keep first'
# check -rmmproc
-run_test 'mhfixmsg 20 -rmmproc true'
-if test -f '${MH_TEST_DIR}/Mail/inbox/20.backup'; then
+run_test 'mhfixmsg 21 -rmmproc true'
+if test -f '${MH_TEST_DIR}/Mail/inbox/21.backup'; then
echo check of mhfixmsg -rmmproc FAILED, should not have created backup file
failed=`expr ${failed:-0} + 1`
fi
This is the text/plain part.
------- =_aaaaaaaaaa0
-Content-Type: text/plain; charset="iso-8859-1"; name="test2.txt"
+Content-Type: text/html; charset="iso-8859-1"; name="test2.txt"
Content-Disposition: attachment; filename="test2.txt"
Content-Transfer-Encoding: 8bit
<html>
<head>
- This is the text/html part.
+ This was the text/html part.
</head>
</body>
</html>
This is the text/plain part.
------- =_aaaaaaaaaa0
-Content-Type: text/plain; charset="iso-8859-1"; name="test2.txt"
+Content-Type: text/html; charset="iso-8859-1"; name="test2.txt"
Content-Disposition: attachment; filename="test2.txt"
Content-Transfer-Encoding: base64
-PGh0bWw+CjxoZWFkPgogICAgVGhpcyBpcyB0aGUgdGV4dC9odG1sIHBhcnQuCjwvaGVhZD4KPC9i
-b2R5Pgo8L2h0bWw+Cg==
+PGh0bWw+CjxoZWFkPgogICAgVGhpcyB3YXMgdGhlIHRleHQvaHRtbCBwYXJ0Lgo8L2hlYWQ+Cjwv
+Ym9keT4KPC9odG1sPgo=
------- =_aaaaaaaaaa0--
EOF
-run_prog mhfixmsg last -outfile "$actual"
+run_prog mhfixmsg last -outfile "$actual" -noreformat
check "$expected" "$actual"
This is the text/plain part.
------- =_aaaaaaaaaa0
-Content-Type: multipart/alternative; boundary="----=_nmh-multipart2"
+Content-Type: text/html; charset="iso-8859-1"; name="test2.txt"
+Content-Disposition: attachment; filename="test2.txt"
+Content-Transfer-Encoding: base64
-------=_nmh-multipart2
-Content-Type: text/plain; charset="iso-8859-1"; name="test2.txt"
-Content-Transfer-Encoding: 8bit
+PGh0bWw+DQo8aGVhZD4NCiAgICBUaGlzIGlzIHRoZSB0ZXh0L2h0bWwgcGFydC4NCjwvaGVhZD4N
+CjwvYm9keT4NCjwvaHRtbD4NCg==
-This is the text/html part.
+------- =_aaaaaaaaaa0--
+EOF
+
+cat >`mhpath new` <<EOF
+To: recipient@example.com
+From: sender@example.com
+Subject: mhfixmsg decode test 4
+MIME-Version: 1.0
+Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
+
+------- =_aaaaaaaaaa0
+Content-Type: text/plain; charset="iso-8859-1"
+Content-Disposition: attachment; filename="test1.txt"
+Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
+Content-Transfer-Encoding: quoted-printable
+
+This is the text/plain part.
-------=_nmh-multipart2
+------- =_aaaaaaaaaa0
Content-Type: text/html; charset="iso-8859-1"; name="test2.txt"
Content-Disposition: attachment; filename="test2.txt"
Content-Transfer-Encoding: base64
PGh0bWw+DQo8aGVhZD4NCiAgICBUaGlzIGlzIHRoZSB0ZXh0L2h0bWwgcGFydC4NCjwvaGVhZD4N
CjwvYm9keT4NCjwvaHRtbD4NCg==
-------=_nmh-multipart2--
+------- =_aaaaaaaaaa0--
+EOF
+run_prog mhfixmsg last -outfile "$actual" -decodetypes text/plain -noreformat
+check "$expected" "$actual"
+
+
+# check -decodetypes attachment/ics
+cat >$expected <<EOF
+To: recipient@example.com
+From: sender@example.com
+Subject: mhfixmsg decode test 5
+MIME-Version: 1.0
+Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
+
+------- =_aaaaaaaaaa0
+Content-Type: text/plain; charset="iso-8859-1"
+Content-Disposition: attachment; filename="test1.txt"
+Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
+Content-Transfer-Encoding: 8bit
+
+This is the text/plain part.
+
+------- =_aaaaaaaaaa0
+Content-Type: application/ics; charset="iso-8859-1"; name="invite.ics"
+Content-Disposition: attachment; filename="invite.ics"
+Content-Transfer-Encoding: 8bit
+
+BEGIN:VCALENDAR\r
+VERSION:2.0\r
+PRODID:test-mhical\r
+BEGIN:VEVENT\r
+DTSTAMP:20150101T162400Z\r
+DTSTART:20150105T160000\r
+DTEND:20150105T163000\r
+SUMMARY:4 pm meeting\r
+END:VEVENT\r
+END:VCALENDAR\r
------- =_aaaaaaaaaa0--
EOF
cat >`mhpath new` <<EOF
To: recipient@example.com
From: sender@example.com
-Subject: mhfixmsg decode test 4
+Subject: mhfixmsg decode test 5
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
Content-Transfer-Encoding: quoted-printable
+This is the=
+ text/plain part.
+
+------- =_aaaaaaaaaa0
+Content-Type: application/ics; charset="iso-8859-1"; name="invite.ics"
+Content-Disposition: attachment; filename="invite.ics"
+Content-Transfer-Encoding: base64
+
+QkVHSU46VkNBTEVOREFSDQpWRVJTSU9OOjIuMA0KUFJPRElEOnRlc3QtbWhpY2FsDQpCRUdJTjpW
+RVZFTlQNCkRUU1RBTVA6MjAxNTAxMDFUMTYyNDAwWg0KRFRTVEFSVDoyMDE1MDEwNVQxNjAwMDAN
+CkRURU5EOjIwMTUwMTA1VDE2MzAwMA0KU1VNTUFSWTo0IHBtIG1lZXRpbmcNCkVORDpWRVZFTlQN
+CkVORDpWQ0FMRU5EQVINCg==
+
+------- =_aaaaaaaaaa0--
+EOF
+run_prog mhfixmsg last -outfile "$actual" -noreformat
+check "$expected" "$actual"
+
+
+# check -decodetypes attachment/ics and -nocrlflinebreaks
+cat >$expected <<EOF
+To: recipient@example.com
+From: sender@example.com
+Subject: mhfixmsg decode test 5
+MIME-Version: 1.0
+Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
+
+------- =_aaaaaaaaaa0
+Content-Type: text/plain; charset="iso-8859-1"
+Content-Disposition: attachment; filename="test1.txt"
+Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
+Content-Transfer-Encoding: 8bit
+
This is the text/plain part.
------- =_aaaaaaaaaa0
-Content-Type: text/html; charset="iso-8859-1"; name="test2.txt"
-Content-Disposition: attachment; filename="test2.txt"
+Content-Type: application/ics; charset="iso-8859-1"; name="invite.ics"
+Content-Disposition: attachment; filename="invite.ics"
+Content-Transfer-Encoding: 8bit
+
+BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:test-mhical
+BEGIN:VEVENT
+DTSTAMP:20150101T162400Z
+DTSTART:20150105T160000
+DTEND:20150105T163000
+SUMMARY:4 pm meeting
+END:VEVENT
+END:VCALENDAR
+
+------- =_aaaaaaaaaa0--
+EOF
+
+cat >`mhpath new` <<EOF
+To: recipient@example.com
+From: sender@example.com
+Subject: mhfixmsg decode test 5
+MIME-Version: 1.0
+Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
+
+------- =_aaaaaaaaaa0
+Content-Type: text/plain; charset="iso-8859-1"
+Content-Disposition: attachment; filename="test1.txt"
+Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
+Content-Transfer-Encoding: quoted-printable
+
+This is the=
+ text/plain part.
+
+------- =_aaaaaaaaaa0
+Content-Type: application/ics; charset="iso-8859-1"; name="invite.ics"
+Content-Disposition: attachment; filename="invite.ics"
Content-Transfer-Encoding: base64
-PGh0bWw+CjxoZWFkPgogICAgVGhpcyBpcyB0aGUgdGV4dC9odG1sIHBhcnQuCjwvaGVhZD4KPC9i
-b2R5Pgo8L2h0bWw+Cg==
+QkVHSU46VkNBTEVOREFSDQpWRVJTSU9OOjIuMA0KUFJPRElEOnRlc3QtbWhpY2FsDQpCRUdJTjpW
+RVZFTlQNCkRUU1RBTVA6MjAxNTAxMDFUMTYyNDAwWg0KRFRTVEFSVDoyMDE1MDEwNVQxNjAwMDAN
+CkRURU5EOjIwMTUwMTA1VDE2MzAwMA0KU1VNTUFSWTo0IHBtIG1lZXRpbmcNCkVORDpWRVZFTlQN
+CkVORDpWQ0FMRU5EQVINCg==
------- =_aaaaaaaaaa0--
EOF
-run_prog mhfixmsg last -outfile "$actual" -decodetypes text/plain
+run_prog mhfixmsg last -outfile "$actual" -nocrlflinebreaks -noreformat
check "$expected" "$actual"