git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] contrib/hooks/post-receive-email: send individual mails to recipients

From
Michael Adam <obnox@samba.org>
Date
Nov 12, 2008, 16:21 UTC
Message-ID
<E1L0ITB-00Bv9t-72@intern.SerNet.DE>

This changes the behaviour of post-receive-email when a list of recipients (separated by commas) is specified as hooks.mailinglist. With this modification, an individual mail is sent out for each recipient entry in the list, instead of sending a single mail with all the recipients in the "To: " field.

Signed-off-by: Michael Adam <obnox@samba.org>
---
 contrib/hooks/post-receive-email |   30 +++++++++++++++++-------------
 1 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/contrib/hooks/post-receive-email b/contrib/hooks/post-receive-email
index 28a3c0e..5deaf28 100644
--- a/contrib/hooks/post-receive-email
+++ b/contrib/hooks/post-receive-email
@@ -169,21 +169,25 @@ generate_email()
 		describe=$rev
 	fi
 
-	generate_email_header
+	# loop over the recipients to send individual mails
+	echo $recipients | sed -e 's/\s*,\s*/\n/' | while read recipient
+	do
+		generate_email_header
 
-	# Call the correct body generation function
-	fn_name=general
-	case "$refname_type" in
-	"tracking branch"|branch)
-		fn_name=branch
-		;;
-	"annotated tag")
-		fn_name=atag
-		;;
-	esac
-	generate_${change_type}_${fn_name}_email
+		# Call the correct body generation function
+		fn_name=general
+		case "$refname_type" in
+		"tracking branch"|branch)
+			fn_name=branch
+			;;
+		"annotated tag")
+			fn_name=atag
+			;;
+		esac
+		generate_${change_type}_${fn_name}_email
 
-	generate_email_footer
+		generate_email_footer
+	done
 }
 
 generate_email_header()
-- 
1.5.6
Next: Junio C Hamano
Message 1 of 5 in “contrib/hooks/post-receive-email: send individual mails to recipients”
  1. contrib/hooks/post-receive-email: send individual mails to recipientsMichael Adam, Nov 12, 2008
  2. Junio C HamanoNov 12, 2008
  3. Michael AdamNov 12, 2008
  4. Junio C HamanoNov 12, 2008
  5. Michael AdamNov 12, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.