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 "sendmail: ${srcdir}/test/fakesendmail\n" >>"$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"
38 # It's hard to calculate the exact Date: header post is going to
39 # use, so we'll just use sed to remove the actual date so we can easily
40 # compare it against our "correct" output. And same for charset.
42 sed -e 's/^Date:.*/Date:/' -e 's/; charset=".*//' \
43 "`mhpath cur`" > "${testname}.actual"
45 check "${testname}.actual" "$1"
48 # check that 7-bit body isn't encoded
49 cat > "${MH_TEST_DIR}/attachment.txt" <<EOF
53 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
54 From: Mr Nobody <nobody@example.com>
55 To: Somebody <somebody@example.com>
57 Nmh-Attachment: $MH_TEST_DIR/attachment.txt
62 cat > "${testname}.expected" <<EOF
63 From: Mr Nobody <nobody@example.com>
64 To: Somebody <somebody@example.com>
67 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
71 Content-Type: text/plain
76 Content-Type: text/plain; name="attachment.txt"
77 Content-Description: attachment.txt
78 Content-Disposition: attachment; filename="attachment.txt"
82 ------- =_aaaaaaaaaa0--
85 test_attachment "${testname}.expected"
87 # check that 8-bit body is encoded as quoted-printable text/plain,
88 # even with an attachment
90 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
91 From: Mr Nobody <nobody@example.com>
92 To: Somebody <somebody@example.com>
94 Nmh-Attachment: $MH_TEST_DIR/attachment.txt
99 cat > "${testname}.expected" <<EOF
100 From: Mr Nobody <nobody@example.com>
101 To: Somebody <somebody@example.com>
104 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
107 ------- =_aaaaaaaaaa0
108 Content-Type: text/plain
109 Content-Transfer-Encoding: quoted-printable
113 ------- =_aaaaaaaaaa0
114 Content-Type: text/plain; name="attachment.txt"
115 Content-Description: attachment.txt
116 Content-Disposition: attachment; filename="attachment.txt"
118 this is an attachment
120 ------- =_aaaaaaaaaa0--
123 test_attachment "${testname}.expected"
125 rm -f ${MHMTSCONF} "${MH_TEST_DIR}/attachment.txt"