2 ######################################################
4 # Test UTF-8 body along with an attachment
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"
18 testname="${MH_TEST_DIR}/$$"
21 #### Rely on sendmail/pipe below to override default mts.
22 mts_fakesendmail="${MHMTSCONF}-fakesendmail"
23 cp "${MHMTSCONF}" "$mts_fakesendmail"
24 printf "%s\n" "sendmail: ${srcdir}/test/fakesendmail" >>"$mts_fakesendmail"
25 MHMTSCONF="$mts_fakesendmail"
27 # argument: expected output
30 send -draft -mts sendmail/pipe
32 # fakesendmail drops the message and any cc's into this mbox.
33 mbox="${MH_TEST_DIR}"/Mail/fakesendmail.mbox
34 inc -silent -file "$mbox"
35 rm -f "$mbox" "$mbox.map"
40 # It's hard to calculate the exact Date: header post is going to
41 # use, so we'll just use sed to remove the actual date so we can easily
42 # compare it against our "correct" output. And same for charset.
44 sed -e 's/^Date:.*/Date:/' \
45 -e 's/; charset=".*//' \
46 "$cur" > "${testname}.actual"
48 check "${testname}.actual" "$1"
51 # check that 7-bit body isn't encoded
52 cat > "${MH_TEST_DIR}/attachment.txt" <<EOF
56 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
57 From: Mr Nobody <nobody@example.com>
58 To: Somebody Else <somebody@example.com>
60 Nmh-Attachment: $MH_TEST_DIR/attachment.txt
65 cat > "${testname}.expected" <<EOF
66 From: Mr Nobody <nobody@example.com>
67 To: Somebody Else <somebody@example.com>
70 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
74 Content-Type: text/plain
79 Content-Type: text/plain; name="attachment.txt"
80 Content-Description: attachment.txt
81 Content-Disposition: attachment; filename="attachment.txt"
85 ------- =_aaaaaaaaaa0--
88 test_attachment "${testname}.expected"
90 # check that 8-bit body is still encoded as quoted-printable
91 # text/plain, even with an attachment
93 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
94 From: Mr Nobody <nobody@example.com>
95 To: Somebody Else <somebody@example.com>
97 Nmh-Attachment: $MH_TEST_DIR/attachment.txt
102 cat > "${testname}.expected" <<EOF
103 From: Mr Nobody <nobody@example.com>
104 To: Somebody Else <somebody@example.com>
107 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
110 ------- =_aaaaaaaaaa0
111 Content-Type: text/plain
112 Content-Transfer-Encoding: quoted-printable
116 ------- =_aaaaaaaaaa0
117 Content-Type: text/plain; name="attachment.txt"
118 Content-Description: attachment.txt
119 Content-Disposition: attachment; filename="attachment.txt"
121 this is an attachment
123 ------- =_aaaaaaaaaa0--
126 test_attachment "${testname}.expected"
128 rm -f ${MHMTSCONF} "${MH_TEST_DIR}/attachment.txt"