X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/38de48ccf6bcdac1212d541fa33d7a1f3490484f..476f7e5e6e32469a347a055922be6b3d0e45d8ba:/test/mhmail/test-mhmail diff --git a/test/mhmail/test-mhmail b/test/mhmail/test-mhmail index 31d6689e..df921b6d 100755 --- a/test/mhmail/test-mhmail +++ b/test/mhmail/test-mhmail @@ -14,6 +14,22 @@ fi . "${srcdir}/test/post/test-post-common.sh" +# Find MIME type string, using mimetypeproc if configured with it. +MIMETYPEPROC=`mhparam mimetypeproc` +content_type_string() { + if test -z "$MIMETYPEPROC"; then + echo "text/plain; name=\"`basename $1`\"; charset=\"us-ascii\"" + else + # 1) Excise leading filename followed by : and any whitespace. + # 2) Insert semicolon if there isn't one before the first space. + # OpenBSD file --mime spits out things like "text/plain charset=...". + # 3) Wrap charset value in double quotes. Assume that it isn't already. + printf "%s %s%s" \ + `$MIMETYPEPROC $1 | sed -e 's/.*: *//' -e 's/\([^;]\) /\1; /' \ + -e 's/\(charset=\)\(.*\)/\1"\2"/'` "; name=\"`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 @@ -791,7 +807,7 @@ Content-Type: text/plain; charset="us-ascii" 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"