Removed double quotes around case arguments in test scripts.
[mmh] / test / post / test-post-bcc
1 #!/bin/sh
2 #
3 # Test the behavior of post with multiple recipients and the use of Bcc:
4 #
5
6 set -e
7
8 if test -z "${MH_OBJ_DIR}"; then
9     srcdir=`dirname "$0"`/../..
10     MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
11 fi
12
13 . "${srcdir}/test/post/test-post-common.sh"
14
15 #
16 # Bcc test.
17 #
18 # It's worth pointing out here what's going on the SMTP protocol.
19 #
20 # If there are both sighted and unsighted addresses in the address list,
21 # post calls verify_all_addresses() which results in ALL recipient
22 # addresses being attempted, then the SMTP connection is reset, then
23 # both the sighted and unsigned messages are sent (in different SMTP
24 # transactions).  Apparantly post has always done it this way.
25 #
26
27 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
28 From: Mr Nobody <nobody@example.com>
29 To: Somebody One <somebody1@example.com>,
30     Somebody Two <somebody2@example.com>
31 Subject: Test Bcc
32 Bcc: Somebody Three <somebody3@example.com>,
33      Somebody Four <somebody4@example.com>
34
35 This is test of Bcc recipients.
36 EOF
37
38 cat > "${testname}.expected" <<EOF
39 EHLO nosuchhost.example.com
40 MAIL FROM:<nobody@example.com>
41 RCPT TO:<somebody1@example.com>
42 RCPT TO:<somebody2@example.com>
43 RCPT TO:<somebody3@example.com>
44 RCPT TO:<somebody4@example.com>
45 RSET
46 MAIL FROM:<nobody@example.com>
47 RCPT TO:<somebody1@example.com>
48 RCPT TO:<somebody2@example.com>
49 DATA
50 From: Mr Nobody <nobody@example.com>
51 To: Somebody One <somebody1@example.com>,
52     Somebody Two <somebody2@example.com>
53 Subject: Test Bcc
54 Date:
55
56 This is test of Bcc recipients.
57 .
58 RSET
59 MAIL FROM:<nobody@example.com>
60 RCPT TO:<somebody3@example.com>
61 RCPT TO:<somebody4@example.com>
62 DATA
63 From: Mr Nobody <nobody@example.com>
64 Date:
65 Subject: Test Bcc
66 BCC:
67
68 ------- Blind-Carbon-Copy
69
70 From: Mr Nobody <nobody@example.com>
71 To: Somebody One <somebody1@example.com>,
72     Somebody Two <somebody2@example.com>
73 Subject: Test Bcc
74 Date:
75
76 This is test of Bcc recipients.
77
78 ------- End of Blind-Carbon-Copy
79 .
80 QUIT
81 EOF
82
83 test_post "${testname}.actual" "${testname}.expected"
84
85 exit ${failed:-0}