]> diplodocus.org Git - nmh/blob - test/post/test-rfc6531
Added test of SMTP server that doesn't support SMTPUTF8.
[nmh] / test / post / test-rfc6531
1 #!/bin/sh
2 ######################################################
3 #
4 # Test SMTPUTF8 (RFC 6531) support.
5 #
6 ######################################################
7
8 set -e
9
10 if test -z "${MH_OBJ_DIR}"; then
11 srcdir=`dirname $0`/../..
12 MH_OBJ_DIR=`cd $srcdir && pwd`; export MH_OBJ_DIR
13 fi
14
15 . "${srcdir}/test/post/test-post-common.sh"
16
17 setup_test
18 mhl="${MH_LIBEXEC_DIR}/mhl"
19 SMTPUTF8=1; export SMTPUTF8
20
21 #### Make sure that html-to-text conversion is what we expect.
22 require_locale en_US.utf-8 en_US.utf8
23 LC_ALL=en_US.UTF-8; export LC_ALL
24
25 #### Enable EAI in mhbuild, via the profile.
26 sed "s%^\(mhbuild: .*\)%\1 -headerencoding utf-8%" "$MH" >"$MH.new"
27 mv -f "$MH.new" "$MH"
28
29 # check SMTPUTF8 basic
30 start_test 'SMTPUTF8 basic'
31
32 cat > "${testname}.expected" <<EOF
33 EHLO nosuchhost.example.com
34 MAIL FROM:<senderø@example.com> BODY=8BITMIME SMTPUTF8
35 RCPT TO:<recipientæ@example.com>
36 DATA
37 From: senderø@example.com
38 To: recipientæ@example.com
39 Subject: Blåbærsyltetøy
40 MIME-Version: 1.0
41 Content-Type: text/plain; charset="UTF-8"
42 Content-Transfer-Encoding: 8bit
43 Date:
44
45 Blåbærsyltetøy er veldig godt. Jeg liker blåbærsyltetøy.
46 Jøran.
47
48 Text source:
49 Arnt Gulbrandsen and Jiankang Yao, "Email Address Internationalization",
50 Computing Edge 1:6, June 2015,
51 http://www.computer.org/cms/computing-edge/ce-jun15-final.pdf, p. 50.
52 .
53 QUIT
54 EOF
55
56 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
57 From: senderø@example.com
58 To: recipientæ@example.com
59 Subject: Blåbærsyltetøy
60 --------
61 Blåbærsyltetøy er veldig godt. Jeg liker blåbærsyltetøy.
62 Jøran.
63
64 Text source:
65 Arnt Gulbrandsen and Jiankang Yao, "Email Address Internationalization",
66 Computing Edge 1:6, June 2015,
67 http://www.computer.org/cms/computing-edge/ce-jun15-final.pdf, p. 50.
68 EOF
69
70 test_post "${testname}.actual" "${testname}.expected"
71
72
73 start_test "smtp server doesn't support SMTPUTF8"
74 unset SMTPUTF8
75 cat > "${testname}.expected" <<EOF
76 EHLO nosuchhost.example.com
77 RSET
78 QUIT
79 EOF
80 cat > "${testname}.expected.err" <<EOF
81 post: problem initializing server; [BHST] ready; I'll buy that for a dollar!
82 send: message not delivered to anyone
83 EOF
84 mv -f "${MH_TEST_DIR}/Mail/,draft" "${MH_TEST_DIR}/Mail/draft"
85
86 set +e
87 test_post "${testname}.actual" "${testname}.expected" 2>"${testname}.err"
88 set -e
89 check "${testname}.err" "${testname}.expected.err"
90
91
92 finish_test
93 exit $failed