changeset 690:87ce0eef5872

GrpAction mail sent one by one
author HIROSE Yuuji <yuuji@gentei.org>
date Tue, 19 May 2020 08:53:33 +0900
parents 13fb1392d2f2
children 39879f81afc8
files s4-funcs.sh
diffstat 1 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/s4-funcs.sh	Mon May 18 19:15:11 2020 +0900
+++ b/s4-funcs.sh	Tue May 19 08:53:33 2020 +0900
@@ -2699,19 +2699,22 @@
 	)
       fi
       rcpts="`email4groupbyuid "$grp" $usel` $fromad$supprcpt"
+      rcpts=`echo $rcpts|tr ' ' '\n'|sort|uniq`
       subj="${subj:-$gecos さんからのメッセージ}"
       REPLYTO=$replyto
-      SMAIL_TO="$user $fromad$supprcpt"
       MAIL_FROM=$mail_from
       export REPLYTO SMAIL_TO MAIL_FROM
       err "GrpActionSend: user=[$user], MAIL_FROM=[$mail_from], rcpts=[$rcpts], REPLYTO=[$replyto}"
-      if [ -n "$afiles" ];then
-	./sendmultipart.sh -t "$rcpts" -s "$subj" -f "$mail_from" $afiles
-      else
-	smail "$rcpts" "$subj"
-      fi <<EOF
+      for r in $rcpts; do
+	SMAIL_TO="$r $user $fromad"
+	if [ -n "$afiles" ];then
+	  ./sendmultipart.sh -t "$r" -s "$subj" -f "$mail_from" $afiles
+	else
+	  smail "$r" "$subj"
+	fi <<EOF
 ${preface:+$preface$nl}$text
 EOF
+      done
       if [ $? = 0 ]; then
 	echo "Note: 以下のメンバーにメッセージを送信しました。" | html p
 	sql="select coalesce(b.val, a.name) from

yatex.org