]> diplodocus.org Git - nmh/blob - test/post/test-post-bcc
new.c: Order two return statements to match comment.
[nmh] / 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 MIME-Version: 1.0
55 Content-Type: text/plain; charset="us-ascii"
56 Date:
57
58 This is test of Bcc recipients.
59 .
60 RSET
61 MAIL FROM:<nobody@example.com>
62 RCPT TO:<somebody3@example.com>
63 RCPT TO:<somebody4@example.com>
64 DATA
65 From: Mr Nobody <nobody@example.com>
66 Date:
67 Subject: Test Bcc
68 BCC:
69
70 ------- Blind-Carbon-Copy
71
72 From: Mr Nobody <nobody@example.com>
73 To: Somebody One <somebody1@example.com>,
74 Somebody Two <somebody2@example.com>
75 Subject: Test Bcc
76 MIME-Version: 1.0
77 Content-Type: text/plain; charset="us-ascii"
78 Date:
79
80 This is test of Bcc recipients.
81
82 ------- End of Blind-Carbon-Copy
83 .
84 QUIT
85 EOF
86
87 test_post "${testname}.actual" "${testname}.expected"
88
89 exit ${failed:-0}