X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/8ba186801a31551de4f12ffd26b617a02b289d32..f064e80eac20967124b9dfc154d24a58de74b623:/test/post/test-mhmail diff --git a/test/post/test-mhmail b/test/post/test-mhmail index 17c95054..422c647d 100755 --- a/test/post/test-mhmail +++ b/test/post/test-mhmail @@ -77,12 +77,14 @@ Usage: mhmail [addrs ... [switches]] -b(ody) text -c(c) addrs ... -f(rom) addr - -s(ubject) text + -hea(der-field) name:field [-hea(der-field) name:field] ... + -su(bject) text -r(esent) -pr(ofile) + -se(nd) + -nose(nd) -v(ersion) - -h(elp) - -d(ebug) + -hel(p) and all post(8)/send(1) switches EOF @@ -111,20 +113,18 @@ case `mhmail` in esac -# check -debug +# check -nosend # Not supported by compiled mhmail. -mhmail -debug recipient@example.com -from sender@localhost \ +mhmail -nosend recipient@example.com -from sender@localhost \ -server 127.0.0.1 -port $localport -body '' >"$actual" 2>"$actual_err" tmpfil=`head -1 $actual | sed -e 's/://'` cat > "$expected" < "$expected_err" < "$expected" < +RCPT TO: +DATA +To: recipient@example.com +From: sender@localhost +Date: + +message +. +QUIT +EOF + +test_mhmail "$expected" "-from sender@localhost -nosend -send" '|' message +[ ${failed:-0} -eq 0 ] || exit ${failed:-0} + + # check -from # Verified same behavior as compiled mhmail. cat > "$expected" < "$expected" < +MAIL FROM: RCPT TO: DATA Resent-To: recipient@example.com -Resent-From: recipient@example.com +Resent-From: orig_recipient@example.com To: recipient@example.com From: sender@localhost Date: Resent-Date: -please resend this message +please resend this message, 1 +. +QUIT +EOF +test_mhmail "$expected" '-from orig_recipient@example.com -resent' \ + -b 'To: recipient@example.com +From: sender@localhost +Date: Sat Jun 16 18:35:15 -0500 + +please resend this message, 1' + +[ ${failed:-0} -eq 0 ] || exit ${failed:-0} + +# check -resent -profile, using stdin +# Not supported by compiled mhmail. +cat > "$expected" < +RCPT TO: +DATA +To: recipient@example.com +From: sender@localhost +Date: +Resent-To: recipient@example.com +Resent-From: orig_recipient@example.com +Resent-Date: + +please resend this message, 2 . QUIT EOF -test_mhmail "$expected" "-from recipient@example.com -resent" \ - -b "To: recipient@example.com +test_mhmail "$expected" \ + '-from orig_recipient@example.com -resent -profile -nomsgid' \ + '|' 'To: recipient@example.com From: sender@localhost Date: Sat Jun 16 18:35:15 -0500 -please resend this message -" +please resend this message, 2' + +[ ${failed:-0} -eq 0 ] || exit ${failed:-0} + + +# check -resent -profile, using -b +# Not supported by compiled mhmail. +cat > "$expected" < +RCPT TO: +DATA +To: recipient@example.com +From: sender@localhost +Date: +Resent-To: recipient@example.com +Resent-From: orig_recipient@example.com +Resent-Date: + +please resend this message, 3 +. +QUIT +EOF + +test_mhmail "$expected" \ + '-from orig_recipient@example.com -resent -profile -nomsgid' \ + -b 'To: recipient@example.com +From: sender@localhost +Date: Sat Jun 16 18:35:15 -0500 + +please resend this message, 3' + +[ ${failed:-0} -eq 0 ] || exit ${failed:-0} + + +# check -header-field. +# Not supported by compiled mhmail. +cat > "$expected" < +RCPT TO: +DATA +To: recipient@example.com +From: sender@example.com +User-Agent: nmh +Date: + +with added header field +. +QUIT +EOF + +test_mhmail "$expected" \ + '-from sender@example.com -header-field User-Agent:nmh' \ + -b 'with added header field' + +[ ${failed:-0} -eq 0 ] || exit ${failed:-0} + + +# check multiple -header-fields. +# Not supported by compiled mhmail. +cat > "$expected" < +RCPT TO: +DATA +To: recipient@example.com +From: sender@example.com +MIME-Version: 1.0 +Content-Type: text/plain;charset=utf-8 +Content-Transfer-Encoding: 8bit +Date: + +with added header fields +. +QUIT +EOF + +test_mhmail "$expected" \ + "-from sender@example.com -header-field MIME-Version:1.0 \ +-header-field Content-Type:text/plain;charset=utf-8 \ +-header-field Content-Transfer-Encoding:8bit" \ + -b 'with added header fields' [ ${failed:-0} -eq 0 ] || exit ${failed:-0}