3 # Test the setting of the envelope-from address for SMTP
5 # Note here we use multiple From: addresses for some tests so we pick up
6 # some cases skipped in other tests.
11 if test -z "${MH_OBJ_DIR}"; then
12 srcdir=`dirname "$0"`/../..
13 MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
16 . "${srcdir}/test/post/test-post-common.sh"
22 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
23 From: Mr Nobody One <nobody1@example.com>,
24 Mr Nobody Two <nobody2@example.com>
25 Sender: Mr Nobody Three <nobody3@example.com>
26 To: Somebody Else <somebody@example.com>
29 This is a test of the Sender header.
32 cat > "${testname}.0.expected" <<EOF
33 EHLO nosuchhost.example.com
34 MAIL FROM:<nobody3@example.com>
35 RCPT TO:<somebody@example.com>
37 From: Mr Nobody One <nobody1@example.com>,
38 Mr Nobody Two <nobody2@example.com>
39 Sender: Mr Nobody Three <nobody3@example.com>
40 To: Somebody Else <somebody@example.com>
44 This is a test of the Sender header.
49 test_post "${testname}.0.actual" "${testname}.0.expected"
52 # Check to see if Envelope-From overrides Sender
55 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
56 From: Mr Nobody One <nobody1@example.com>,
57 Mr Nobody Two <nobody2@example.com>
58 Sender: Mr Nobody Three <nobody3@example.com>
59 Envelope-From: Mr Nobody Four <nobody4@example.com>
60 To: Somebody Else <somebody@example.com>
61 Subject: Envelope-From test
63 This is a test of the Envelope-From header.
66 cat > "${testname}.1.expected" <<EOF
67 EHLO nosuchhost.example.com
68 MAIL FROM:<nobody4@example.com>
69 RCPT TO:<somebody@example.com>
71 From: Mr Nobody One <nobody1@example.com>,
72 Mr Nobody Two <nobody2@example.com>
73 Sender: Mr Nobody Three <nobody3@example.com>
74 To: Somebody Else <somebody@example.com>
75 Subject: Envelope-From test
78 This is a test of the Envelope-From header.
83 test_post "${testname}.1.actual" "${testname}.1.expected"
86 # See if Envelope-From will generate a Sender: header with multiple From:
90 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
91 From: Mr Nobody One <nobody1@example.com>,
92 Mr Nobody Two <nobody2@example.com>
93 Envelope-From: Mr Nobody Four <nobody4@example.com>
94 To: Somebody Else <somebody@example.com>
95 Subject: Envelope-From and Sender test
97 This is a test of the Envelope-From and Sender headers.
100 cat > "${testname}.2.expected" <<EOF
101 EHLO nosuchhost.example.com
102 MAIL FROM:<nobody4@example.com>
103 RCPT TO:<somebody@example.com>
105 From: Mr Nobody One <nobody1@example.com>,
106 Mr Nobody Two <nobody2@example.com>
107 To: Somebody Else <somebody@example.com>
108 Subject: Envelope-From and Sender test
110 Sender: nobody4@example.com
112 This is a test of the Envelope-From and Sender headers.
117 test_post "${testname}.2.actual" "${testname}.2.expected"
120 # And make sure we do NOT get a Sender with only one From:
123 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
124 From: Mr Nobody One <nobody1@example.com>
125 Envelope-From: Mr Nobody Five <nobody5@example.com>
126 To: Somebody Else <somebody@example.com>
127 Subject: Solo Envelope-From test
129 This is a solo test of the Envelope-From header.
132 cat > "${testname}.3.expected" <<EOF
133 EHLO nosuchhost.example.com
134 MAIL FROM:<nobody5@example.com>
135 RCPT TO:<somebody@example.com>
137 From: Mr Nobody One <nobody1@example.com>
138 To: Somebody Else <somebody@example.com>
139 Subject: Solo Envelope-From test
142 This is a solo test of the Envelope-From header.
147 test_post "${testname}.3.actual" "${testname}.3.expected"
150 # Make sure blank Envelope-From does what we expect it to
153 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
154 From: Mr Nobody One <nobody1@example.com>
156 To: Somebody Else <somebody@example.com>
157 Subject: Blank Envelope-From test
159 This is a blank test of the Envelope-From header.
162 cat > "${testname}.4.expected" <<EOF
163 EHLO nosuchhost.example.com
165 RCPT TO:<somebody@example.com>
167 From: Mr Nobody One <nobody1@example.com>
168 To: Somebody Else <somebody@example.com>
169 Subject: Blank Envelope-From test
172 This is a blank test of the Envelope-From header.
177 test_post "${testname}.4.actual" "${testname}.4.expected"