Mercurial > hgrepos > hgweb.cgi > s4
changeset 661:14a7c23f3f06
Allow supplemental rcpt address and file attachment in DM in grpAction
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Mon, 11 May 2020 23:03:11 +0900 |
parents | 347ea2bca687 |
children | 3acb3dca6686 |
files | s4-funcs.sh sendmultipart.sh |
diffstat | 2 files changed, 34 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/s4-funcs.sh Mon May 11 23:01:19 2020 +0900 +++ b/s4-funcs.sh Mon May 11 23:03:11 2020 +0900 @@ -2662,11 +2662,27 @@ checkdomain "$a" && supprcpt="$supprcpt $a" done fi + ## Start parse of attachment files + if [ -n `getpar attach` ]; then + afiles="" + for fn in `query "SELECT DISTINCT val FROM par WHERE var='files';"` + do + f=$tmpd/$fn + if [ -s $f ]; then + afiles=$afiles"${afiles:+ }$f" + fi + done + fi ## SENDER=$noreply \ # Should not SENDER be set to $noreply?? - REPLYTO=$replyto \ - MAIL_FROM=$mail_from \ - smail "`email4groupbyuid "$grp" $usel` $user$supprcpt" \ - "$gecos さんからのメッセージ" <<EOF + rcpts="`email4groupbyuid "$grp" $usel` $user$supprcpt" + subj="$gecos さんからのメッセージ" + REPLYTO=$replyto + MAIL_FROM=$mail_from + if [ -n "$afiles" ];then + ./sendmultipart.sh -t "$rcpts" -s "$subj" -f "$mail_from" $afiles + else + smail "$rcpts" $subj + fi <<EOF $url のグループ「$grp」のメンバーである $gecos さんから、 あなた宛へのメッセージです。 @@ -2822,8 +2838,12 @@ >差出人を自分に(チェックを外すと相手が返事できない)</label><br> <input type="checkbox" name="suppck" id="supp" class="fold"><label for="supp" >宛先追加(通常空欄)</label> -<span class="folded">`cgi_text supprcpt`(下記一覧の1人以上選択しないと無効)</span> +<span class="folded">`cgi_text supprcpt`[実験中](下記一覧の1人以上選択しないと無効)</span> <div>`cgi_textarea text "" cols=40`</div> + +<input type="checkbox" name="attach" id="atta" class="fold"><label for="atta" +>ファイル添付</label> +<span class="folded">`cgi_file files "" multiple`[実験中]</span> </div> ${isowner:+$cmmsg$excmsg} `cgi_radio rm close id="x"`<label for="x">×</label>
--- a/sendmultipart.sh Mon May 11 23:01:19 2020 +0900 +++ b/sendmultipart.sh Mon May 11 23:03:11 2020 +0900 @@ -1,9 +1,10 @@ #!/bin/sh +# 愛 # send multipart message via email # (C)2012,2015 by HIROSE Yuuji [yuuji(at)yatex.org] # You can obtain the latest version of this script from: # http://www.gentei.org/~yuuji/software/sendmultipart.sh -# Last modified Sat May 9 13:09:42 2020 on firestorm +# Last modified Mon May 11 21:42:39 2020 on firestorm # # Typical usage: # echo "Hi, here's photo I've taken. Enjoy" | \ @@ -38,7 +39,9 @@ boundary=\"$boundary\"" textcharset=iso-2022-jp rcpts="" -rcptscomma="" +nl=" +" +rcptheader="" [ -f $conf ] && . $conf # read rc file @@ -46,9 +49,9 @@ case "$1" in -t) shift; rcpts="$rcpts${rcpts:+ }`echo $1|tr , ' '`" - rcptscomma="$rcptscomma${rcptscomma:+, }$1" ;; -s) shift; subject="`echo $1|nkf -M`" ;; + -r) shift; REPLYTO="$1" ;; -f) shift; from="From: $1" ;; -v) verbose=1 ;; -h) usage ;; # -h helpオプション @@ -57,6 +60,7 @@ esac shift done +rcptheader=`echo $rcpts|tr ' ' '\n'|sort -u|sed 's/^/To: /g'` plainheader="Content-Type: text/plain; charset=$textcharset Content-Transfer-Encoding: 7bit" @@ -89,8 +93,8 @@ # Generate contents ( cat<<EOF -To: ${rcptscomma:-[Not specified]} -Subject: ${subject:-$*} +${rcptheader:-To: [Not specified]} +${REPLYTO:+Reply-to: $REPLYTO$nl}Subject: ${subject:-$*} $ctheader Mime-Version: 1.0 X-Mailer: $mailer