]>
diplodocus.org Git - nmh/blob - test/post/test-rfc6531
2 ######################################################
4 # Test SMTPUTF8 (RFC 6531) support.
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 .
"${srcdir}/test/post/test-post-common.sh"
18 mhl
="${MH_LIBEXEC_DIR}/mhl"
19 SMTPUTF8
=1; export SMTPUTF8
21 #### Make sure that html-to-text conversion is what we expect.
22 require_locale en_US.UTF
-8 en_US.UTF8 en_US.utf
-8 en_US.utf8
24 #### Enable EAI in mhbuild, via the profile.
25 sed "s%^\(mhbuild: .*\)%\1 -headerencoding utf-8%" "$MH" >"$MH.new"
28 # check SMTPUTF8 basic
29 start_test
'SMTPUTF8 basic'
31 cat > "${testname}.expected" <<EOF
32 EHLO nosuchhost.example.com
33 MAIL FROM:<senderø@example.com> BODY=8BITMIME SMTPUTF8
34 RCPT TO:<recipientæ@example.com>
36 From: senderø@example.com
37 To: recipientæ@example.com
38 Subject: Blåbærsyltetøy
40 Content-Type: text/plain; charset="UTF-8"
41 Content-Transfer-Encoding: 8bit
44 Blåbærsyltetøy er veldig godt. Jeg liker blåbærsyltetøy.
48 Arnt Gulbrandsen and Jiankang Yao, "Email Address Internationalization",
49 Computing Edge 1:6, June 2015,
50 http://www.computer.org/cms/computing-edge/ce-jun15-final.pdf, p. 50.
55 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
56 From: senderø@example.com
57 To: recipientæ@example.com
58 Subject: Blåbærsyltetøy
60 Blåbærsyltetøy er veldig godt. Jeg liker blåbærsyltetøy.
64 Arnt Gulbrandsen and Jiankang Yao, "Email Address Internationalization",
65 Computing Edge 1:6, June 2015,
66 http://www.computer.org/cms/computing-edge/ce-jun15-final.pdf, p. 50.
69 test_post
"${testname}.actual" "${testname}.expected"
72 # check SMTPUTF8 without 8-bit body
73 start_test
'8-bit headers with ASCII body'
75 cat > "${testname}.expected" <<EOF
76 EHLO nosuchhost.example.com
77 MAIL FROM:<senderø@example.com> BODY=8BITMIME SMTPUTF8
78 RCPT TO:<recipientæ@example.com>
80 From: senderø@example.com
81 To: recipientæ@example.com
82 Subject: Blåbærsyltetøy
84 Content-Type: text/plain; charset="UTF-8"
85 Content-Transfer-Encoding: 8bit
93 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
94 From: senderø@example.com
95 To: recipientæ@example.com
96 Subject: Blåbærsyltetøy
101 test_post
"${testname}.actual" "${testname}.expected"
104 # check with smtp server that doesn't support SMTPUTF8
105 start_test
"smtp server doesn't support SMTPUTF8"
107 cat > "${testname}.expected" <<EOF
108 EHLO nosuchhost.example.com
112 cat > "${testname}.expected.err" <<EOF
113 post: SMTP server does not support SMTPUTF8, not sending.
114 Rebuild message with 7-bit headers, WITHOUT -headerencoding utf-8.
115 post: problem initializing server; [BHST] ready; I'll buy that for a dollar!
116 send: message not delivered to anyone
118 mv -f "${MH_TEST_DIR}/Mail/`mhparam sbackup`draft" "${MH_TEST_DIR}/Mail/draft"
121 test_post
"${testname}.actual" "${testname}.expected" 2>"${testname}.err"
123 check
"${testname}.err" "${testname}.expected.err"