]>
diplodocus.org Git - nmh/blob - test/post/test-mts
3 # Test the sendmail/smtp and sendmail/pipe transport methods
9 if test -z "${MH_OBJ_DIR}"; then
10 srcdir
=`dirname "$0"`/..
/..
11 MH_OBJ_DIR
=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
14 .
"${srcdir}/test/post/test-post-common.sh"
17 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
18 From: Mr Nobody <nobody@example.com>
19 To: Somebody Else <somebody@example.com>
25 cat > "${testname}.expected" <<EOF
26 EHLO nosuchhost.example.com
27 MAIL FROM:<nobody@example.com>
28 RCPT TO:<somebody@example.com>
30 From: Mr Nobody <nobody@example.com>
31 To: Somebody Else <somebody@example.com>
34 Content-Type: text/plain; charset="us-ascii"
42 # check invalid -mts selection
43 start_test
'invalid -mts selection'
44 run_test
"send -draft -mts invalid" \
45 "post: unsupported mts selection \"invalid\"
46 send: message not delivered to anyone"
48 test_post
"${testname}.actual" "${testname}.expected" "-mts smtp"
50 #### Rely on sendmail/smtp or sendmail/pipe below to override default mts.
51 mts_fakesendmail
="${MHMTSCONF}-fakesendmail"
52 cp "${MHMTSCONF}" "$mts_fakesendmail"
53 printf 'sendmail: %s/test/fakesendmail\n' "$srcdir" >>"$mts_fakesendmail"
54 MHMTSCONF
="$mts_fakesendmail"
56 # $1: -mts switch selection
57 # remaining arguments: expected output(s)
60 run_prog send
-draft -mts "$1"
64 # fakesendmail drops the message and any cc's into this mbox.
65 if [ $send_status -eq 0 ]; then
66 mbox
="${MH_TEST_DIR}"/Mail
/fakesendmail.mbox
67 inc
-silent -file "$mbox"
72 for expected
in "$@"; do
74 # It's hard to calculate the exact Date: header post is going to
75 # use, so we'll just use sed to remove the actual date so we can easily
76 # compare it against our "correct" output.
78 sed -e 's/^Date:.*/Date:/' "`mhpath cur`" > "${testname}.actual$n"
80 check
"${testname}.actual$n" "$expected"
82 if [ "`mhpath cur`" != "`mhpath last`" ]; then
83 folder next
>/dev
/null
84 arith_eval
$n + 1; n
=$arith_val
89 # check -mts sendmail/smtp
90 start_test
'-mts sendmail/smtp'
91 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
92 From: Mr Nobody <nobody@example.com>
93 To: Somebody Else <somebody@example.com>
100 cat > "${testname}.expected" <<EOF
101 From: Mr Nobody <nobody@example.com>
102 To: Somebody Else <somebody@example.com>
105 Content-Type: text/plain; charset="us-ascii"
112 test_sendmail sendmail
/smtp
"${testname}.expected"
114 # check -mts sendmail/pipe
115 # Dots are not stuffed because sendmail/pipe causes sendmail to be
117 start_test
'-mts sendmail/pipe'
118 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
119 From: Mr Nobody <nobody@example.com>
120 To: Somebody Else <somebody@example.com>
127 cat > "${testname}.expected" <<EOF
128 From: Mr Nobody <nobody@example.com>
129 To: Somebody Else <somebody@example.com>
132 Content-Type: text/plain; charset="us-ascii"
139 test_sendmail sendmail
/pipe
"${testname}.expected"
141 # check Bcc with sendmail/pipe
142 start_test
'Bcc with sendmail/pipe'
143 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
144 From: Mr Nobody <nobody@example.com>
145 To: Somebody Else <somebody@example.com>
146 Bcc: Silent Partner <bcc@example.com>
153 cat > "${testname}.expected1" <<EOF
154 From: Mr Nobody <nobody@example.com>
155 To: Somebody Else <somebody@example.com>
158 Content-Type: text/plain; charset="us-ascii"
165 cat > "${testname}.expected2" <<EOF
166 From: Mr Nobody <nobody@example.com>
171 ------- Blind-Carbon-Copy
173 From: Mr Nobody <nobody@example.com>
174 To: Somebody Else <somebody@example.com>
177 Content-Type: text/plain; charset="us-ascii"
183 ------- End of Blind-Carbon-Copy
186 test_sendmail sendmail
/pipe
"${testname}.expected1" "${testname}.expected2"
189 # check Dcc with sendmail/pipe: it is unsupported
190 start_test
'Dcc with sendmail/pipe'
191 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
192 From: nobody@example.com
198 cat > "${testname}.expected1" <<EOF
199 post: Dcc header is not supported with sendmail/pipe
200 post: re-format message and try again
201 send: message not delivered to anyone
204 ! test_sendmail sendmail
/pipe
2>"${testname}.actual1"
205 check
"${testname}.actual1" "${testname}.expected1"