3 # fakesendmail - A fake sendmail program used by the nmh test suite
4 # to test the sendmail/smtp and sendmail/pipe mts
7 # This code is Copyright (c) 2012, by the authors of nmh. See the
8 # COPYRIGHT file in the root or documentation directory of the nmh
9 # distribution for complete copyright information.
12 if [ "$MH_TEST_DIR"x = x ]; then
13 printf "$0 is intended for use only by the nmh test suite\n"
17 #### Puts message on stdin in a drop that the test knows about.
18 deliver="${MH_LIB_DIR}/rcvpack ${MH_TEST_DIR}/Mail/fakesendmail.mbox"
22 [ "$arg" = -t ] && found_dasht=1
25 if [ $found_dasht -eq 0 ]; then
30 printf "220 If it can't be done in Bourne shell it's not worth doing\n"
32 #### Strip off carriage returns, they confuse the pattern matching.
33 line=`printf "$line" | tr -d '\r'`
36 DATA) printf "354 do tell\n"; datamode=1 ;;
37 .) printf "250 done\n"; datamode=0; printf "$msg" | $deliver; msg= ;;
38 QUIT) printf "221 byenow\n"; break ;;
39 *) [ $datamode -eq 1 ] && msg="${msg}${line}
40 " || printf "250 OK\n"
46 #### This will delete any lines in the message body that start with Bcc:!
47 sed -e '/^[Bb][Cc][Cc]:/d' | $deliver