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>
40 # check invalid -mts selection
41 run_test "send -draft -mts invalid" \
42 "post: unsupported mts selection \"invalid\"
43 send: message not delivered to anyone"
45 test_post "${testname}.actual" "${testname}.expected" "-mts smtp"
47 #### Rely on sendmail/smtp or sendmail/pipe below to override default mts.
48 mts_fakesendmail="${MHMTSCONF}-fakesendmail"
49 cp "${MHMTSCONF}" "$mts_fakesendmail"
50 printf "%s\n" "sendmail: ${srcdir}/test/fakesendmail" >>"$mts_fakesendmail"
51 MHMTSCONF="$mts_fakesendmail"
53 # $1: -mts switch selection
54 # remaining arguments: expected output(s)
60 # fakesendmail drops the message and any cc's into this mbox.
61 mbox="${MH_TEST_DIR}"/Mail/fakesendmail.mbox
62 inc -silent -file "$mbox"
63 rm -f "$mbox" "$mbox.map"
66 for expected in "$@"; do
68 # It's hard to calculate the exact Date: header post is going to
69 # use, so we'll just use sed to remove the actual date so we can easily
70 # compare it against our "correct" output.
72 sed -e 's/^Date:.*/Date:/' "`mhpath cur`" > "${testname}.actual$n"
74 check "${testname}.actual$n" "$expected"
76 if [ "`mhpath cur`" != "`mhpath last`" ]; then
77 folder next >/dev/null
78 arith_eval $n + 1; n=$arith_val
83 # check -mts sendmail/smtp
84 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
85 From: Mr Nobody <nobody@example.com>
86 To: Somebody Else <somebody@example.com>
93 cat > "${testname}.expected" <<EOF
94 From: Mr Nobody <nobody@example.com>
95 To: Somebody Else <somebody@example.com>
103 test_sendmail sendmail/smtp "${testname}.expected"
105 # check -mts sendmail/pipe
106 # Dots are not stuffed because sendmail/pipe causes sendmail to be
108 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
109 From: Mr Nobody <nobody@example.com>
110 To: Somebody Else <somebody@example.com>
117 cat > "${testname}.expected" <<EOF
118 From: Mr Nobody <nobody@example.com>
119 To: Somebody Else <somebody@example.com>
127 test_sendmail sendmail/pipe "${testname}.expected"
130 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
131 From: Mr Nobody <nobody@example.com>
132 To: Somebody Else <somebody@example.com>
133 Bcc: Silent Partner <bcc@example.com>
140 cat > "${testname}.expected1" <<EOF
141 From: Mr Nobody <nobody@example.com>
142 To: Somebody Else <somebody@example.com>
150 cat > "${testname}.expected2" <<EOF
154 ------- Blind-Carbon-Copy
156 From: Mr Nobody <nobody@example.com>
157 To: Somebody Else <somebody@example.com>
164 ------- End of Blind-Carbon-Copy
167 test_sendmail sendmail/pipe "${testname}.expected1" "${testname}.expected2"