s4
changeset 672:4d580bd8c47f
Add charset option to text/plain part header
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Tue, 12 May 2020 11:31:50 +0900 |
parents | ae4dcd28fd39 |
children | 42bf03cb3712 |
files | sendmultipart.sh |
diffstat | 1 files changed, 9 insertions(+), 8 deletions(-) [+] |
line diff
1.1 --- a/sendmultipart.sh Tue May 12 11:04:34 2020 +0900 1.2 +++ b/sendmultipart.sh Tue May 12 11:31:50 2020 +0900 1.3 @@ -4,7 +4,7 @@ 1.4 # (C)2012,2015 by HIROSE Yuuji [yuuji(at)yatex.org] 1.5 # You can obtain the latest version of this script from: 1.6 # http://www.gentei.org/~yuuji/software/sendmultipart.sh 1.7 -# Last modified Tue May 12 11:03:43 2020 on firestorm 1.8 +# Last modified Tue May 12 11:29:54 2020 on firestorm 1.9 # 1.10 # Typical usage: 1.11 # echo "Hi, here's photo I've taken. Enjoy" | \ 1.12 @@ -76,7 +76,7 @@ 1.13 esac 1.14 filename=`echo $1|nkf -M` 1.15 cat<<EOF 1.16 -Content-Type: text/plain; charset="$coding" 1.17 +Content-Type: text/plain; charset=$coding 1.18 Content-Disposition: inline; filename="$filename" 1.19 Content-Transfer-Encoding: $encoding 1.20 1.21 @@ -109,15 +109,16 @@ 1.22 echo 1.23 for file in "$@"; do 1.24 echo "--$boundary" 1.25 - case `echo $file|tolower` in 1.26 - *.txt|*.jis|*.sjis|*.euc|*.utf*) 1.27 - cattextwithheader $file 1.28 + ct=`file --mime-type - < "$file" | cut -d' ' -f2` 1.29 + case "$ct" in 1.30 + [Tt]ext/[Pp]lain*) 1.31 + cattextwithheader "$file" 1.32 ;; 1.33 *) 1.34 - echo -n "Content-Type: " 1.35 - file --mime-type - < "$file" | cut -d' ' -f2 1.36 + echo "Content-Type: $ct" 1.37 + fn=${file##*/} 1.38 echo "Content-Transfer-Encoding: base64" 1.39 - echo "Content-Disposition: inline; filename=\"$file\"" 1.40 + echo "Content-Disposition: inline; filename=\"$fn\"" 1.41 echo 1.42 $base64 $file 1.43 ;;