]> diplodocus.org Git - nmh/blobdiff - test/mhmail/test-mhmail
Okay, fixed a few more things. Almost there?
[nmh] / test / mhmail / test-mhmail
index 31d6689e6697ec2f088ba766590819798d6464ee..ff9fd40b50dec345e24faa5a15bfeb3637d92abd 100755 (executable)
@@ -14,6 +14,21 @@ fi
 
 . "${srcdir}/test/post/test-post-common.sh"
 
 
 . "${srcdir}/test/post/test-post-common.sh"
 
+# Find MIME type string, using configured procs if available.
+MIMETYPEPROC=`mhparam mimetypeproc`
+MIMEENCODINGPROC=`mhparam mimeencodingproc`
+content_type_string() {
+  if test -z "$MIMETYPEPROC"  -o  -z "$MIMEENCODINGPROC"; then
+    #### This should be the order of name and charset.
+    echo "text/plain; name=\"`basename $1`\"; charset=\"us-ascii\""
+  else
+    #### Excise any leading filename followed by : and whitespace.
+    printf '%s; charset="%s"; name="%s"' \
+      `$MIMETYPEPROC $1 | sed -e 's/.*: *//'` \
+      `$MIMEENCODINGPROC $1 | sed -e 's/.*: *//'` `basename $1`
+  fi
+}
+
 # Customize test_post () for use with mhmail.
 # $1 is expected output file, provided by caller
 # $2 is mhmail switches, except for -body
 # Customize test_post () for use with mhmail.
 # $1 is expected output file, provided by caller
 # $2 is mhmail switches, except for -body
@@ -277,6 +292,8 @@ RCPT TO:<recipient@example.com>
 DATA
 To: recipient@example.com
 From: sender8@localhost
 DATA
 To: recipient@example.com
 From: sender8@localhost
+MIME-Version: 1.0
+Content-Type: text/plain; charset="us-ascii"
 Date:
 Message-ID:
 
 Date:
 Message-ID:
 
@@ -791,7 +808,7 @@ Content-Type: text/plain; charset="us-ascii"
 See how easy it is to add an attachment!
 
 ------- =_aaaaaaaaaa0
 See how easy it is to add an attachment!
 
 ------- =_aaaaaaaaaa0
-Content-Type: text/plain; name="attachment.txt"; charset="us-ascii"
+Content-Type: `content_type_string ${srcdir}/test/mhmail/attachment.txt`
 Content-Description: attachment.txt
 Content-Disposition: attachment; filename="attachment.txt"
 
 Content-Description: attachment.txt
 Content-Disposition: attachment; filename="attachment.txt"