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
43 # Content-ID and charset.
45 sed -e 's/^Date:.*/Date:/' \
46 -e 's/^Content-ID:.*/Content-ID:/' \
47 -e 's/; charset=".*//' \
48 "$cur" > "${testname}.actual"
50 check "${testname}.actual" "$1"
53 # check that 7-bit body isn't encoded
54 cat > "${MH_TEST_DIR}/attachment.txt" <<EOF
58 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
59 From: Mr Nobody <nobody@example.com>
60 To: Somebody Else <somebody@example.com>
62 Nmh-Attachment: $MH_TEST_DIR/attachment.txt
67 cat > "${testname}.expected" <<EOF
68 From: Mr Nobody <nobody@example.com>
69 To: Somebody Else <somebody@example.com>
72 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
77 Content-Type: text/plain
82 Content-Type: text/plain; name="attachment.txt"
83 Content-Description: attachment.txt
84 Content-Disposition: attachment; filename="attachment.txt"
88 ------- =_aaaaaaaaaa0--
91 test_attachment "${testname}.expected"
93 # check that 8-bit body is still encoded as quoted-printable
94 # text/plain, even with an attachment
96 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
97 From: Mr Nobody <nobody@example.com>
98 To: Somebody Else <somebody@example.com>
100 Nmh-Attachment: $MH_TEST_DIR/attachment.txt
105 cat > "${testname}.expected" <<EOF
106 From: Mr Nobody <nobody@example.com>
107 To: Somebody Else <somebody@example.com>
110 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
114 ------- =_aaaaaaaaaa0
115 Content-Type: text/plain
116 Content-Transfer-Encoding: quoted-printable
120 ------- =_aaaaaaaaaa0
121 Content-Type: text/plain; name="attachment.txt"
122 Content-Description: attachment.txt
123 Content-Disposition: attachment; filename="attachment.txt"
125 this is an attachment
127 ------- =_aaaaaaaaaa0--
130 test_attachment "${testname}.expected"
132 rm -f ${MHMTSCONF} "${MH_TEST_DIR}/attachment.txt"