]>
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 run_test
"send -draft -mts invalid" \
44 "post: unsupported mts selection \"invalid\"
45 send: message not delivered to anyone"
47 test_post
"${testname}.actual" "${testname}.expected" "-mts smtp"
49 #### Rely on sendmail/smtp or sendmail/pipe below to override default mts.
50 mts_fakesendmail
="${MHMTSCONF}-fakesendmail"
51 cp "${MHMTSCONF}" "$mts_fakesendmail"
52 printf 'sendmail: %s/test/fakesendmail\n' "$srcdir" >>"$mts_fakesendmail"
53 MHMTSCONF
="$mts_fakesendmail"
55 # $1: -mts switch selection
56 # remaining arguments: expected output(s)
59 run_prog send
-draft -mts "$1"
62 # fakesendmail drops the message and any cc's into this mbox.
63 mbox
="${MH_TEST_DIR}"/Mail
/fakesendmail.mbox
64 inc
-silent -file "$mbox"
65 rm -f "$mbox" "$mbox.map"
68 for expected
in "$@"; do
70 # It's hard to calculate the exact Date: header post is going to
71 # use, so we'll just use sed to remove the actual date so we can easily
72 # compare it against our "correct" output.
74 sed -e 's/^Date:.*/Date:/' "`mhpath cur`" > "${testname}.actual$n"
76 check
"${testname}.actual$n" "$expected"
78 if [ "`mhpath cur`" != "`mhpath last`" ]; then
79 folder next
>/dev
/null
80 arith_eval
$n + 1; n
=$arith_val
85 # check -mts sendmail/smtp
86 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
87 From: Mr Nobody <nobody@example.com>
88 To: Somebody Else <somebody@example.com>
95 cat > "${testname}.expected" <<EOF
96 From: Mr Nobody <nobody@example.com>
97 To: Somebody Else <somebody@example.com>
100 Content-Type: text/plain; charset="us-ascii"
107 test_sendmail sendmail
/smtp
"${testname}.expected"
109 # check -mts sendmail/pipe
110 # Dots are not stuffed because sendmail/pipe causes sendmail to be
112 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
113 From: Mr Nobody <nobody@example.com>
114 To: Somebody Else <somebody@example.com>
121 cat > "${testname}.expected" <<EOF
122 From: Mr Nobody <nobody@example.com>
123 To: Somebody Else <somebody@example.com>
126 Content-Type: text/plain; charset="us-ascii"
133 test_sendmail sendmail
/pipe
"${testname}.expected"
136 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
137 From: Mr Nobody <nobody@example.com>
138 To: Somebody Else <somebody@example.com>
139 Bcc: Silent Partner <bcc@example.com>
146 cat > "${testname}.expected1" <<EOF
147 From: Mr Nobody <nobody@example.com>
148 To: Somebody Else <somebody@example.com>
151 Content-Type: text/plain; charset="us-ascii"
158 cat > "${testname}.expected2" <<EOF
159 From: Mr Nobody <nobody@example.com>
163 ------- Blind-Carbon-Copy
165 From: Mr Nobody <nobody@example.com>
166 To: Somebody Else <somebody@example.com>
169 Content-Type: text/plain; charset="us-ascii"
175 ------- End of Blind-Carbon-Copy
178 test_sendmail sendmail
/pipe
"${testname}.expected1" "${testname}.expected2"